Kinematic moveTo needs Space.update first 0.9.0

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Kinematic moveTo needs Space.update first 0.9.0

Post by imtrobin »

Hi

Reporting, not sure if this is considered a bug. When I set a kinematic moveTo, the Space needs an update first before it takes effect. If not, the moveTo is never executed.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Kinematic moveTo needs Space.update first 0.9.0

Post by Norbo »

To check the result, are you using internalCenterPosition or centerPosition? The centerPosition field is buffered and as such requires a space.update to show the latest data. The internalCenterPosition on the other hand accesses 'internal' data directly.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: Kinematic moveTo needs Space.update first 0.9.0

Post by imtrobin »

I'm using moveTo. The order like this won't work

start program
moveTo
update
update
update

this will

start program
update
moveTo
update
update
update
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Kinematic moveTo needs Space.update first 0.9.0

Post by Norbo »

Performing an update prior to a moveTo should not have any effect compared to not updating prior to a moveTo. For example, in the demos project, you can move the ground entity in the startSimulation method before any update occurs using moveTo and it will have the expected result (the ground is moved).

Entity.moveTo is a direct modification of the internal center position without any buffering. It does not wait for an update to occur to take effect. This is reflected in the Entity.internalCenterPosition property, which directly accesses the value with no buffering.

On the other hand, if the centerPosition property is checked immediately after a moveTo, it will not appear that any change has occurred if no update has yet taken place, because the centerPosition property is buffered.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: Kinematic moveTo needs Space.update first 0.9.0

Post by imtrobin »

I was setting the kinematic entities in my loading script to follow the visual after they are created. Without the first update, they are not moved there.
Post Reply