Objects colliding with others of same type
by Alex Parker · in Torque Game Builder · 04/02/2005 (1:27 pm) · 5 replies
Just wondering if its possible for objects on the same layer and group to collide with each other, or can objects only collide with one group or layer and thats final, i.e. I want my asteroids to bounce off each other, as well as be able to destroy the player. Does this mean I'll have to put all my objects in group 1 layer 1 then use if-statements to determine if asteroids collide with asteroids, or with the player, etc? Or is there some automatic feature of Torque that I've missed? Thanks.
#2
I believe that's what you're looking for. ;)
EDIT: After testing my theory, it dosen't seem to be working. I'll work on this somemore and if I can come up with something, I'll let you know.
EDIT2: Fixed. The above code will do what you want. =)
04/02/2005 (3:49 pm)
%asteroid.setCollisionActive( true, true ); %asteroid.setCollisionMasks( BIT(1) | BIT(2), BIT(1) | BIT(2) ); %asteroid.setCollisionPhysics( true, true );
I believe that's what you're looking for. ;)
EDIT: After testing my theory, it dosen't seem to be working. I'll work on this somemore and if I can come up with something, I'll let you know.
EDIT2: Fixed. The above code will do what you want. =)
#3
Thanks for the heads up with combining bits Phillip, I knew there was a way but wasn't sure how.
04/02/2005 (4:05 pm)
Everything else is fine... Collisions are doing my head in! Now my powerups are blowing up my ship, then they're lowing up asteroids... ! I probably need to work it out on paper!Thanks for the heads up with combining bits Phillip, I knew there was a way but wasn't sure how.
#4
04/02/2005 (4:29 pm)
Lol. Maybe moving the powerups to it's own layer/group would help?
#5
04/02/2005 (9:01 pm)
Yeh that worked - I fiddled with putting everything in the same layer but I didn't realise that you could combine bits, although come to think of it, I should have. I think it should be sorted out now, thanx.
Torque Owner John Vanderbeck
VanderGames