hi,
i want to rotate an entity by 90 degrees on the vertical axis.
this is my code:
[CODE]
angle = self:GetAngles()
angle:RotateAroundAxis(Vector(0,0,1),90)
self:SetAngles(angle)
[/CODE]
but no rotation is done. when i rotate with (1,0,0) or (0,1,0) it works as expected.
even when i set the yaw component manually nothing happens. when i read and print the angle the yaw changes if the relative position of my player to the entity changes.
where comes this dependency from and and how can i rotate the entity properly?
Use [URL="http://wiki.garrysmod.com/page/Angle/Up"]Angle.Up[/URL]
[code]angle:RotateAroundAxis(angle:Up(), 90)[/code]
thx, but i found out what the real problem is. i am using this to rotate a nextbot. when i use MoveToPos() the angle gets overwritten, but i want a permanent offset of 90 degrees in the yaw, even while moving. NextBot:BodyMoveXY() seems interesting, but there is no description how it works or what the parameters are.
any suggestions?
ok, it seems that the angle gets overridden every time the bot moves.
the solution is to rotate all bones by 90 degree:
[CODE]
for bone=0, self:GetBoneCount() do
self:ManipulateBoneAngles( bone, Angle(0, 90, 0) )
end
[/CODE]
This works, but the bone positions need to be manipulated with ManipulateBonePosition() too (to include the position after rotation) but i cant figure out how to calculate them. any ideas?
Sorry, you need to Log In to post a reply to this thread.