[Opensim-dev] rotate the avatar

QUcupid cupid_qu at hotmail.com
Fri Jul 30 00:31:13 UTC 2010


Thank you so much. It works now   :)

> Date: Thu, 29 Jul 2010 14:43:06 -0400
> From: teravus at gmail.com
> To: opensim-dev at lists.berlios.de
> Subject: Re: [Opensim-dev] rotate the avatar
> 
> 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
> >
> >
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20100730/644957b2/attachment-0001.html>


More information about the Opensim-dev mailing list