Basic collision testing
3 posters
Basic collision testing
I've got the following scenario
- Object (say the games character) being moved around by the user.
- The camera is fixed
- Number of boxes on a plane
What's the best way of approaching moving the character around and making sure it stops outside the bounds of the boxes ?
With the physics engine turned on I tried setting the character to a dynamic body and set it's velocity to move but it would bounce around when it collided with a static object and I didn't want this.
I also tried updating the transform and letting the physics engine know about it but it seemed to be inconsistent as to when it would let the character pass through the box.
So wondering can I either
- Find the bounds of objects (just where they are and how wide they are) to do my own collision testing
- Have the physics engine only prevent the character from going inside the boxes (and not apply any other 'physics' to it).
- Object (say the games character) being moved around by the user.
- The camera is fixed
- Number of boxes on a plane
What's the best way of approaching moving the character around and making sure it stops outside the bounds of the boxes ?
With the physics engine turned on I tried setting the character to a dynamic body and set it's velocity to move but it would bounce around when it collided with a static object and I didn't want this.
I also tried updating the transform and letting the physics engine know about it but it seemed to be inconsistent as to when it would let the character pass through the box.
So wondering can I either
- Find the bounds of objects (just where they are and how wide they are) to do my own collision testing
- Have the physics engine only prevent the character from going inside the boxes (and not apply any other 'physics' to it).
c3games- Posts : 5
Join date : 2009-05-27
Re: Basic collision testing
Maybe in your case just a ray test would do... check the bullet SDK for more information, this is outside the scope of SIO2...
Re: Basic collision testing
Alright, well I tried doing a ray but found it was only giving me a 'hit' (or really I should say a non hit) when the character was in the middle of the box, so it didn't seem to look like it was testing the 'bounds'.
I realise this question may also be a bit off topic but as I'm exporting all these items from blender through the sio2 script maybe I'm doing something wrong and you could save me a bit of time by giving him a hint as to what that might be!
Any thing I should be setting up to make sure the bounds are working properly ?
Note: I've also noticed it's a problem if I turn the engine on and let it bounce the object off the other when an angular velocity is applied so it looks like it's a problem with the info on the models rather than something I'm doing in code...
I realise this question may also be a bit off topic but as I'm exporting all these items from blender through the sio2 script maybe I'm doing something wrong and you could save me a bit of time by giving him a hint as to what that might be!
Any thing I should be setting up to make sure the bounds are working properly ?
Note: I've also noticed it's a problem if I turn the engine on and let it bounce the object off the other when an angular velocity is applied so it looks like it's a problem with the info on the models rather than something I'm doing in code...
c3games- Posts : 5
Join date : 2009-05-27
Re: Basic collision testing
Seems to help if I do something like
sio2PhysicRender( sio2->_SIO2physic, 1.0f / 60, 20 );
Though the peformance takes a pretty huge nose dive...
sio2PhysicRender( sio2->_SIO2physic, 1.0f / 60, 20 );
Though the peformance takes a pretty huge nose dive...
c3games- Posts : 5
Join date : 2009-05-27
Re: Basic collision testing
Well in order tosave you and save me slot of time I would suggest to watch all the video tutorials especially the one for tutorial06.
Re: Basic collision testing
How about using a Collision Sensor and setting the linear velocity to empty vector when a collision is detected (not tested, just a suggestion)
finthamoussu- Posts : 10
Join date : 2009-03-30
Age : 41
Location : Montevideo, Uruguay
Re: Basic collision testing
Cheers for the suggestions...
I couldn't get the bullet collision working 100% with my boxes so I've implemented my own collision testing just on whether the rect of the box overlaps the character.
It's strange as I tried some tests with dropping some spheres into the scene and have them bounce around. They seemed to bounce off each other faithfully though again with the boxes they would collide in the center of them rather than on the sides...
I did try with a 'freshly' created box and that was the same.
Probably doing something wrong but it doesn't matter for now as my implementation not using bullet works fine for what i need and will be much more efficient anyway (not to say bullet isn't efficient just that it's probably overkill).
I couldn't get the bullet collision working 100% with my boxes so I've implemented my own collision testing just on whether the rect of the box overlaps the character.
It's strange as I tried some tests with dropping some spheres into the scene and have them bounce around. They seemed to bounce off each other faithfully though again with the boxes they would collide in the center of them rather than on the sides...
I did try with a 'freshly' created box and that was the same.
Probably doing something wrong but it doesn't matter for now as my implementation not using bullet works fine for what i need and will be much more efficient anyway (not to say bullet isn't efficient just that it's probably overkill).
c3games- Posts : 5
Join date : 2009-05-27
Similar topics
» Collision Again
» Testing and failing Object duplication
» SIO2 Remote Application for Testing
» collision and scale :(
» Collision system
» Testing and failing Object duplication
» SIO2 Remote Application for Testing
» collision and scale :(
» Collision system
Permissions in this forum:
You cannot reply to topics in this forum