Posted by: wil5on
Date posted: Jul 18 2004 User Rating: N/A | Number of views: 6520 Number of comments: 3 | Description: Make the RPG like the UT redeemer, easy! |
Basically to get the players view from the weapons position, you need to use SET_VIEW when the projectile is created, and SET_VIEW again when its destroyed. For example:
| | if (m_pPlayer) SET_VIEW( m_pPlayer->edict(), edict() );
|
Stick this into a projectiles think function for flying. Make sure you set up m_pPlayer as a pointer back to the player who fired the rocket (CBasePlayer *m_pPlayer), and set it in the function where the weapon gets fired.
Heres the code neccessary to make it guidable:
| | UTIL_MakeVectors( m_pPlayer->pev->v_angle ); pev->angles = m_pPlayer->pev->v_angle; pev->velocity = gpGlobals->v_forward * 500;
|
This just sets the projectiles angles and velocity to match the direction the players looking. I chose 500 there because I think its a good speed for a Redeemer rocket, you can change that to whatever.
Finally, you have to set the players view back to the player, so in whatever function gets called when the projectile hits something, stick this:
| | SET_VIEW( m_pPlayer->edict(), m_pPlayer->edict() );
|
Well, thats all you really need to know. Have fun, and happy coding! |
|
User Comments
Showing comments 1-3
IMHO, Everyone knows that.. |
|
i'd like a guide on how to do in hl2 :)Edited by paccer on Feb 15 2005, 21:32:55
|
|
You must register to post a comment. If you have already registered, you must login.
|