Entity Angles
Im trying to make a guided missile (using the fakemeta version of attach view and velocity_by_aim..)
Everything works fine except I want the missile to only fire forwards. The player start off with their view attached to an entity (that fires that missile), this means that they can't look around at all but moving the mouse still changes something because the missile fires in whatever direction you are 'looking' even though it appeared you were looking straight. Code:
That's the code to launch the missile. Ship contains the entity id of the original firing entity and angles has the pev_v_angles of the ship.. Code:
And that's the steering code. Since this is getting confusingly long i'll recap. The missle firing works perfectly and so does the attach views and guiding. The only problem is that the missle is supposed to fire out straight infront of the 'ship' entity and then let the user steer the missle from there. Instead it will fire out at whatever direction the user is looking.. In the create missile section i've tried setting pev_angles and pev_v_angle for the user but this seems to have no effect... |
Re: Entity Angles
edit: one sec, rethinking.
Try using the ships angles into angle_vector to get an initial velocity, instead of using velocity_by_aim. |
Re: Entity Angles
Initial Vector is fine..
i've modified the missile steering code to this.. Code:
Which works as intended, you can rotate the missile around freely with the mouse and when you click it changes to travel in the direction you are looking. It also fires dead straight from the ship but the problem is still the your current looking direction is the same as previous. So for example you fire a missile and your looking out the back of it as it fires along straight. Spinning the mouse around so you look forward and then start clicking to guide it and it works fine.. Since it is the players angle the sets the angle of the missile entity I'm guessing I'd need to set the players angle to straight infront. But I'm pretty sure I've done that and it doesn't help.. |
Re: Entity Angles
dw.
set_pev(id,pev_fixangle,1) fixed it.. |
| All times are GMT -4. The time now is 06:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.