kinematic body collision?

ripper9100
Posts: 10
Joined: Mon Sep 08, 2008 2:27 am

kinematic body collision?

Post by ripper9100 »

Hi,

I have a kinematic body defined and I am using the following code to move it from left to right:

Code: Select all

transform.getOrigin() += btVector3(stuff);
         Body->getMotionState()->setWorldTransform(transform);
	 Body->setWorldTransform(transform);
My current problem is that when I throw a ball at the object it doesn't detect the collision when the object is towards the sides of the screen but strangely enough it does detect a collision when the body is towards the center of the screen. At first I thought that only the graphics object was moving and the physics object was staying in its initial position, the center of the screen. But I have confirmed through the debug mode that the collision shape of the body is shadowing the physics object as it's moving so I don't understand what is the problem.

I've been stuck on this problem for a few days now and I've tried to do everything I could think of and nothing has worked so far. I would greatly appreciate it if someone could lend me a hand with this.

Here's a screenshot of my project in debug mode:
The box is the object I'm shooting at and in this screenshot the box is away from the center so if I were to throw a ball at the box it would go right through
even though it clearly shows the collision box shape around the graphic representation of the box.
Image
ripper9100
Posts: 10
Joined: Mon Sep 08, 2008 2:27 am

Re: kinematic body collision?

Post by ripper9100 »

I found a solution to my above problem by removing and adding the rigid body after moving it. Is doing this the best solution or should I be doing something else?
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: kinematic body collision?

Post by pico »

Hi,

maybe you experience tunneling? Search for setCcdMotionThreshold in the forums if you want to test a possible solutions.
ripper9100
Posts: 10
Joined: Mon Sep 08, 2008 2:27 am

Re: kinematic body collision?

Post by ripper9100 »

pico wrote:Hi,

maybe you experience tunneling? Search for setCcdMotionThreshold in the forums if you want to test a possible solutions.
I thought it could be this as well but after trying setCcdMotionThreshold and setCcdSweptSphereRadius it didn't help. The ball would still go through even if I threw it at a slow speed. Removing and adding the rigidbodies has been the only solution i've found so far.