FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Basic collision testing

3 posters

Go down

Basic collision testing Empty Basic collision testing

Post  c3games Wed May 27, 2009 8:30 pm

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).

c3games

Posts : 5
Join date : 2009-05-27

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  sio2interactive Wed May 27, 2009 8:32 pm

Maybe in your case just a ray test would do... check the bullet SDK for more information, this is outside the scope of SIO2...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  c3games Thu May 28, 2009 12:55 am

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...

c3games

Posts : 5
Join date : 2009-05-27

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  c3games Thu May 28, 2009 2:07 am

Seems to help if I do something like

sio2PhysicRender( sio2->_SIO2physic, 1.0f / 60, 20 );

Though the peformance takes a pretty huge nose dive...

c3games

Posts : 5
Join date : 2009-05-27

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  sio2interactive Thu May 28, 2009 7:59 am

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.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  finthamoussu Thu May 28, 2009 10:25 am

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
finthamoussu

Posts : 10
Join date : 2009-03-30
Age : 41
Location : Montevideo, Uruguay

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  c3games Fri May 29, 2009 7:51 am

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).

c3games

Posts : 5
Join date : 2009-05-27

Back to top Go down

Basic collision testing Empty Re: Basic collision testing

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum