Collisions... what's up with them?
by rennie moffat · in Torque Game Builder · 07/17/2009 (10:12 am) · 23 replies
Hi there,
So I am moving along at a good clip. I have built an astroid style game. However, one thing that is urking me are collisions between my PlayerShip and EnemyShip.
I have turned, send and receive both collision and physics for both, with out callback as I have no scripting yet. I set "Groups" for each to collide with, 1 and 2 appropriately. Now when I play the game, they just float right over each other, with out a budge. Could anyone please help me better understand what I need to do in order to have them collide?
So I am moving along at a good clip. I have built an astroid style game. However, one thing that is urking me are collisions between my PlayerShip and EnemyShip.
I have turned, send and receive both collision and physics for both, with out callback as I have no scripting yet. I set "Groups" for each to collide with, 1 and 2 appropriately. Now when I play the game, they just float right over each other, with out a budge. Could anyone please help me better understand what I need to do in order to have them collide?
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
07/17/2009 (10:28 am)
I am a bit rusty but here goes. Not sure if you saw this or not, but there is also a group setting under SceneObject right under Layer. This will be the actual group the object is in. If this doesn't work you might want to try putting them in the same group. You shouldn't have to but playing with it is usually how I get it to work right for me.
#3
07/17/2009 (10:30 am)
You're right, you do not have to have the callback turned on, TGB will handle the collision for you.
#4
07/17/2009 (10:30 am)
ok, well from what I have told you, can you see anything wrong with that?
#5
07/17/2009 (10:31 am)
oops. just saw first post. please hold.
#6
07/17/2009 (10:54 am)
ok i have played with it a bit, and still nothing. I will keep trying, but in the meantime, with just basic programing, should they essentially just bounce off one another?
#7
07/17/2009 (11:00 am)
still not working. in theory tho, could i, should i write a collision behaviour?
#8
You could try to write one, but I doubt that will change the situation.
07/17/2009 (11:07 am)
In the editor with nothing selected, open up the Debug Rendering tab and put a check in Collision Bounds. Make sure there is a green collision shape of some sort on both entities. Run it and see if the green collision shapes are still present in both.You could try to write one, but I doubt that will change the situation.
#9
07/17/2009 (12:20 pm)
I'm not 100% on this but are they both on the same layer? i think they should be.
#10
07/17/2009 (12:32 pm)
currently the are on the same layer, but I tried them on separate, with only the relative group, layer selected, and with all selected. Still nothing, must be missing something, have to step out now, but will try Greg's last bit of advice shortly. Hopefully that will work.
#11
when they collide with eachother, the callback should trigger and all that, but unless you set up the physics, chances are that they will keep on colliding until they take different routes.
so, you either correctly setup the physics (mass, inertia and all that) to each objct, o you have to setup the OnCollision callback, to tell the program how to react when they collide (you can use or not the physics here... ).
hope it helps.
07/17/2009 (2:32 pm)
i think the problem here is that you havent properly set up the physics of the objects.when they collide with eachother, the callback should trigger and all that, but unless you set up the physics, chances are that they will keep on colliding until they take different routes.
so, you either correctly setup the physics (mass, inertia and all that) to each objct, o you have to setup the OnCollision callback, to tell the program how to react when they collide (you can use or not the physics here... ).
hope it helps.
#12
I tried but the physics had me puzzled slightly.
I was looking at the variables, why have an X and Y "velocity, when below it you have a Min and Max Velocity?
07/17/2009 (9:51 pm)
I got back to my computer just now and I have to say, I tried but the physics had me puzzled slightly.
I was looking at the variables, why have an X and Y "velocity, when below it you have a Min and Max Velocity?
#13
07/17/2009 (9:52 pm)
Also, what are the other variables, I am sure I can look them up somewhere but constant force etc, angular velocity, these are little things I am not sure of at the moment.... or at all. HELP!!!!
#14
say, you want your asteroids to bounce when they collide with your ship?... set the collision response for those as "BOUNCE", and set the ship's collision response as u wish (even KILL if you want it to be deleted from the scene if collides with something)...
i think that's what you're looking for ... the physics are mostly used in more advanced collisions, i think.
07/17/2009 (11:47 pm)
oh... another thing i remembered (its been awhile since last time i thinkered with that), when you set up the collision on an object, you can also setup its collision mode, with that, you dont really need to setup the physics, unless you need to.say, you want your asteroids to bounce when they collide with your ship?... set the collision response for those as "BOUNCE", and set the ship's collision response as u wish (even KILL if you want it to be deleted from the scene if collides with something)...
i think that's what you're looking for ... the physics are mostly used in more advanced collisions, i think.
#15
Just to keep you up to date, as of last night i had a game with a playership that moved around as I controlled it, shot bullets, killed an enemy who could respawn and chase the hero ship.
NOw, it is all gone, nothing was saved for some reason.. ridic seeing as you have to save each time you reload, which i did, many times, bad sign for future, hope not, good this is only a get to know you type project.
ANyhow... Problem is, relinking the behaviours and making the game really shouldnt be a big deal seeing as it is only a very simple game with a half dozen behaviours currently.
Well, the behaviours are not behaving. My ships controls work nothing like how they were and it continually crashes. WTF?!
07/18/2009 (10:16 am)
ok great thanks guys. Just to keep you up to date, as of last night i had a game with a playership that moved around as I controlled it, shot bullets, killed an enemy who could respawn and chase the hero ship.
NOw, it is all gone, nothing was saved for some reason.. ridic seeing as you have to save each time you reload, which i did, many times, bad sign for future, hope not, good this is only a get to know you type project.
ANyhow... Problem is, relinking the behaviours and making the game really shouldnt be a big deal seeing as it is only a very simple game with a half dozen behaviours currently.
Well, the behaviours are not behaving. My ships controls work nothing like how they were and it continually crashes. WTF?!
#16
I have gone to the Debug Rendering and have chosen Collision Bounds. A yellowy green box has appeared over both payer and enemy (both set to send and receive collisions on all levels). I ran the game, the yellow-green boxes still appear but no collisions take place.
:?
07/18/2009 (10:56 am)
re: Greg, I have gone to the Debug Rendering and have chosen Collision Bounds. A yellowy green box has appeared over both payer and enemy (both set to send and receive collisions on all levels). I ran the game, the yellow-green boxes still appear but no collisions take place.
:?
#17
OK, now its time to get detailed, thanks guys.
07/18/2009 (10:57 am)
OK, SO I just added, send and recieve phyics and now they collide. HOORAH!OK, now its time to get detailed, thanks guys.
#18
then, create a new project and start all over, and see what happens. i think something on TGB got screwed up, and its givin you the finger...
sometimes it happens to me that i create particles or stuff like that, and they get deleted with no aparent reason... i mean, the file is still there, but the particles just get totally screwed up and dont play...
07/18/2009 (11:02 am)
try deleting the "GarageGames" directory on "applications Settings", and then reinstall TGB.then, create a new project and start all over, and see what happens. i think something on TGB got screwed up, and its givin you the finger...
sometimes it happens to me that i create particles or stuff like that, and they get deleted with no aparent reason... i mean, the file is still there, but the particles just get totally screwed up and dont play...
#19
Yah, it seems a bit buggy, hopefully the good guys at TGB will be debugging the system over the next little while, to make it smoother for us, because if it is smoother for us, it will mean more props for them as we;'ll have better games developed.
OH JHESS, I Like it tho.
07/18/2009 (11:16 am)
cool , well its working now.Yah, it seems a bit buggy, hopefully the good guys at TGB will be debugging the system over the next little while, to make it smoother for us, because if it is smoother for us, it will mean more props for them as we;'ll have better games developed.
OH JHESS, I Like it tho.
#20
So I have moved onto a maze type game I want to build. I have decided to use a TileMap to construct the maze. I will simply turn the collisions on the particular tiles, and on the overall map to insure my player bumps into the walls where he is supposed to, this is what I was anticipating but notta. Nothing. My player simply flies over the walls like nothing.
Any tips?
07/18/2009 (6:41 pm)
OK, So I have moved onto a maze type game I want to build. I have decided to use a TileMap to construct the maze. I will simply turn the collisions on the particular tiles, and on the overall map to insure my player bumps into the walls where he is supposed to, this is what I was anticipating but notta. Nothing. My player simply flies over the walls like nothing.
Any tips?
Torque Owner rennie moffat
Renman3000
But i was thinking the TGB interface was able to take care of that. Am I Wrong?