[Opensim-dev] rotate the avatar
Teravus Ovares
teravus at gmail.com
Thu Jul 29 18:43:06 UTC 2010
in Javascript;
var Heading = 0.0;
var m_pi = Math.PI;
var m_pi2 = m_pi * 2;
var m_degreespms = 240;
var m_turnIncrement = (m_pi / m_degreespms);
Turn Left:
aCF.addBitmask(ControlFlags.TURN_LEFT);
Heading = NormalizeHeading(Heading + m_turnIncrement * 10);
Turn Right:
aCF.addBitmask(ControlFlags.TURN_RIGHT);
Heading = NormalizeHeading(Heading - m_turnIncrement * 10);
function NormalizeHeading(heading)
{
while (heading >= m_pi)
heading -= m_pi2;
while (heading < -m_pi)
heading += m_pi2;
return heading;
}
var BodyRotationX = 0;
var BodyRotationY = 0;
var BodyRotationZ = Math.sin(Heading / 2.0);
var BodyRotationW = Math.cos(Heading / 2.0);
-----------------
In C# with libomv;
You update the heading as above and then there's a call to update via heading.
Self.Movement.UpdateFromHeading(heading ,false);
Hopefully this helps!
Teravus
2010/7/29 QUcupid <cupid_qu at hotmail.com>:
> Hi, i'm writing code for controlling the avatar with balance board. Anyone
> can told me where can i change the headrotation or bodyrotation?
> For moving forward and backward or any other movements like
> SIT_ON_GROUND,FLY , i'm using the ANGENTMANAGER.CONTROLFLAGS, but it
> seems that the controlflags doesn't work with the headrotation or
> bodyrotation.
> many thanks
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
>
More information about the Opensim-dev
mailing list