SetTargetPoint () Update the Y offset

Topics regarding Scripting with Reality Factory
Post Reply
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

SetTargetPoint () Update the Y offset

Post by rgdyman »

Hey all.

This is my first attempt at scripted player stuff. So Please excuse my ignorance.
This may not even work

What Im doing is trying to shoot at a enemy pawn wether the enemy is in front of, higher than or lower than the plawer pawn.

So far I have the pawn realizing who is the new enemy pawn when the cursor is over the new enemy pawn.
Now I need to update the OFF_Set_Y in the SetTargetPoint( );
Or to simplify this ordeal.... I would like the bullet to aim at my mouse cursor. and fire in that direction.
Any Ideas how to do this?



Heres what I have thus far......( updated the new enemy not included )

SHOOT[()
{
AnimationSpeed(SHOOTSPEED);
MatchPlayerAngles();
UpdateTarget();
????? HERE I think------> SetTargetPoint(0,NEED THE UPDATED Y ,360);
if(self.animate_at_end)
{
FireProjectile("Shot","BIP01 R HAND",0,0,0,"PHealth");
PlaySound("deagle.wav");
if(self.lbutton_pressed=false)
{
ANM=StringCopy("Idle");
Animate(ANM);
think="Stand_Idle";
}
}
}]

I may be going about this all wrong in the first place.. if so.... any suggestions on the proper way to tackle this

sorry i forgot... im in 3rd person view
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: SetTargetPoint () Update the Y offset

Post by Juutis »

There's a variable called self.camera_pitch that tells the pitch of the camera.

So it's pretty simple to calculate the correct offsets with trigonometry:

Code: Select all

SetTargetPoint(0,360*sin(self.camera_pitch),360*cos(self.camera_pitch));
Pain is only psychological.
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Re: SetTargetPoint () Update the Y offset

Post by rgdyman »

There. Thank you Juutis.

I tried the camera_pitch w/out the trig... obviously my route didnt work...

[SetTargetPoint(0,360*sin(-self.camera_pitch)+50,360*cos(self.camera_pitch));]

( side " dumb" question ..... * this means what? )

Just had to make the Y= a Neg number and add 50 to hit my crosshair..

Thanks again

rgdy
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: SetTargetPoint () Update the Y offset

Post by Juutis »

rgdyman wrote:( side " dumb" question ..... * this means what? )
That's the multiplication sign. :P
Pain is only psychological.
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Re: SetTargetPoint () Update the Y offset

Post by rgdyman »

:oops: I thought so.. was afraid I was way off base.. Eithere way "Looken stupid"

Impressive 8)
Post Reply