I've been needing to control my body for a player via the XForm.position and Xform.R - so that it is directly responsive. When using XForm.R.Set(angle) the getAngle() on body doesnt return the change. The Debug Draw works off the shapes Xform values and so updates and displays correctly. I have had to change how my code works - to get my angles directly from the Xform.R to draw sprites - This works fine.
Should the body.getAngle() return the same as the XForm.R.GetAngle(); ?? this would make it represent the DebugDraw better
So are you getting you angle directly after you edit the xform? between the same timesteps?
Beceause if so, then you aren't letting Bx2d process the XForm change, therefore, yes you will have to change your code...
I am getting the angle at the end of the timestep (every frame) and updating my sprite - the sprite doesnt change at all - the angle returned is always 0 - like the angle is not updated. In the code, the getAngle is working of a variable m_sweep -> which has something to do with CCD? My position for getPosition works fine editing the XForm however.
either way - it works as expected when i use the XForm.R.getRotation
ah ok then, i'm not sure what the problem is then, I'll leave this issue to the "senior" members 😛
Not certain, but i get the impression from your first post you are doing this:
body.GetXForm().R.Set(angle)
body.GetAngle()
That will not work, as the XForm you get from body isn't linked to it, you have just changed an unrelated XForm, then discarded it.
var xform:b2XForm = body.GetXForm();
xform.R.Set(angle)
body.SetXForm(xform)
body.GetAngle()
should work, though it's untested. It's just one of these C++ idioms that is less well known to AS3 coders.