Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Collision detection problem using TNT Collision engine — Gideros Forum

Collision detection problem using TNT Collision engine

simransimran Member
edited June 2014 in General questions
I have this piece of code to detect collision between an object 'sechand' which is rotating and a character which is translating along boundary of ellipse. Now, I am using TNT collision Engine to detect collsiions. It does detect collision but only if I never jump the character, Once I jump it, it never detects the collision happening any time in the game .I
have attached the snapshot in this post as well.
Please help me fix this



if playertouch then
speed = 10
angle2 = 30
speedx = math.cos(20)
speedy = math.sin(130)
velocityx = speed*speedx
velocityy = speed*speedy
point = tntCollision.pointToObox
x = x + velocityx
y = y + velocityy
self: setScaleY(1.8)
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
end

elseif playertouch == false then
x = x - velocityx
y = y - velocityy
x = 215 + math.cos(angle)*195
y = 130 + math.sin(angle)*115
self:setScaleY(1)
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
end
else
x = 215 + math.cos(angle)*195
y = 130 + math.sin(angle)*115
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
print('end of game')
end
end
self:setPosition(x,y)
cap.PNG
359 x 522 - 170K
cap.PNG 170.4K
Sign In or Register to comment.