Data Realms Fan Forums http://45.55.195.193/ |
|
Aiming direction http://45.55.195.193/viewtopic.php?f=73&t=21741 |
Page 1 of 1 |
Author: | Asklar [ Wed Mar 09, 2011 9:48 pm ] |
Post subject: | Aiming direction |
How can I make an AEmitter have the RotAngle of where the parent actor is aiming? If I set (considering I already did the code for who is the parent) self.RotAngle = self.parent.RotAngle would work? |
Author: | Coops [ Thu Mar 10, 2011 12:18 am ] |
Post subject: | Re: Aiming direction |
You'd want something like this instead since aiming angle has its own function. Code: self.<Emitter>.RotAngle = self.<Actor>:GetAimAngle(true) or if you always want the guns angle just get the gun's angle itself. If you get the actor's Rotational Angle then your getting the angle his torso is. I believe GetAimAngle gets the angle of the head or where your cursor is aiming in respect of the selected actor. |
Author: | Asklar [ Thu Mar 10, 2011 1:21 am ] |
Post subject: | Re: Aiming direction |
Wait, so it would be better to get the gun's aim angle?? Code: function Create(self) local curdist = 50; for actors in MovableMan.Actors do local avgx = actors.Pos.X - self.Pos.X; local avgy = actors.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < curdist then curdist = dist; self.parent = actors; end end end function Update(self) self.RotAngle = self.parent.RotAngle end This is my code so far. I tried to get the gun's angle, but I don't know how to do that. |
Author: | Roast Veg [ Thu Mar 10, 2011 1:25 am ] |
Post subject: | Re: Aiming direction |
No. Aim angle only applies to things that can see. (Actors, AHumans and ACrabs) |
Author: | Asklar [ Thu Mar 10, 2011 1:26 am ] |
Post subject: | Re: Aiming direction |
So it would be the guns RotAngle? |
Author: | Roast Veg [ Thu Mar 10, 2011 1:32 am ] |
Post subject: | Re: Aiming direction |
The actor's aim angle. |
Author: | Coops [ Thu Mar 10, 2011 1:40 am ] |
Post subject: | Re: Aiming direction |
GetAimAngle only works on Actors, just like Roast Veg said. To get a non-actor's Rotational Angle, use .RotAngle like you are now. Just use the aim angle method I gave you. Replace the Code: self.RotAngle = self.parent.RotAngle with Code: self.RotAngle = self.parent:GetAimAngle(true) and it should work. |
Author: | Asklar [ Thu Mar 10, 2011 8:09 pm ] |
Post subject: | Re: Aiming direction |
Hey, it works! Thanks guys. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |