A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by yoshi » Mon Jun 13, 2011 5:16 pm
Hi!
I'm having a little issue with my application: I'm moving my character around the scene with setVelocity but I noticed that when he bumps into a wall
he continues to move back and forth quickly as it is trying to "penetrate" the wall.
The body still has linear velocity when colliding with the wall, so I thought about setting it to zero when the player is trying to walk toward the wall,
but is there any easier solution?
I tried setting elasticity and softness to zero, enabled continous collision mode and it helped a bit, but the small "bouncing" is still noticeable.
Thanks in advance

Note: I'm using ogrenewt with the latest newton
-
yoshi
-
- Posts: 4
- Joined: Sun Apr 10, 2011 4:27 am
by microdot » Tue Jun 14, 2011 5:51 am
Never done this sort of controlling, but perhaps there is a damping property or something similar?
-

microdot
-
- Posts: 26
- Joined: Thu Oct 25, 2007 12:20 pm
- Location: Johannesburg, South Africa
-
by JernejL » Tue Jun 14, 2011 6:23 pm
How are you materials set up?
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by yoshi » Tue Jun 14, 2011 7:31 pm
The collision shape for the character is a sphere and the wall is a box, and in their material pair I set softness and elasticity to zero, enabled continousCollisionMode and nothing else.
The character also has an upvector constraint but I don't think that is the cause..
-
yoshi
-
- Posts: 4
- Joined: Sun Apr 10, 2011 4:27 am
by JoeJ » Sun Jun 19, 2011 5:47 am
As Julio said, it's possible to set velocities directly, but my experience ist that this is fatal in some cases, and not good in general.
I recommend you to use force and torque whenever possible, so newton can calculate possible velocities.
It's impossible for a rigid sphere at a wall to have velocity pointing into the wall.
force = ((targetVel - currentVel) * (mass / timestep));
In your callback replace targetVel with the velocity you're currently using, and get currentVel from NewtonBodyGetVelocity().
-

JoeJ
-
- Posts: 1489
- Joined: Tue Dec 21, 2010 6:18 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests