Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / FPS projectile mouse aim

Author
Message
cazub
16
Years of Service
User Offline
Joined: 29th Jul 2008
Location: here
Posted: 30th Jul 2008 02:28
Hi guys, i'd like to shoot a projectile (ball, square, teapot) starting from where my camera is, and in the direction my mouse is pointing. Y axis is up/down , Z is front/back and X is left/right.

for now i'm not worried about the up/down Y axis, and heres what i do now, i get the current mouseAngle, store it. I set a velocity to 10 for my projectile. Then go in and set my projectile through each iteration of the gameLoop like this

velocity = velocity - .8;
x = x + ( velocity * cos(mouseAngleY) );
z = z + ( velocity * sin(mouseAngleY) );
projectilePosition( x , y , z)

so right now it goes off at a constant speed and never stops once i hit fire. Not only that but the mouseAngle only works if i'm looking in a specific quadrant and even then i dunno what its doing. All i wanna do is set up a basic shooter and if I can't chuck projectiles where i'm aiming then i'm kinda boned. Any ideas guys? Forums been super helpful sofar so i'm crossin my fingers.

hey doods

Login to post a reply

Server time is: 2024-09-30 03:29:42
Your offset time is: 2024-09-30 03:29:42