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.

DarkBASIC Discussion / Monster Hunt Tut 3.4- Tracer Bullet Problem

Author
Message
Parapsycho
18
Years of Service
User Offline
Joined: 15th Nov 2006
Location:
Posted: 16th Nov 2006 00:11
Hi everyone.

I'm doing the Monster Hunt tutorial, and right now I'm on 3.4, the one where you make and fire a bullet. I was able to get it to work, but afterwards I was messing aound with changing the code to see what would happen. There is a game that I would like to try to re-create later in DB that uses a "tracer bullet" effect for it's bullets.

I changed


to



Everything works fine, except the tracer bullet always stays parallel to the ground. So, If I tilt the camera up 90 degrees, I fire a horizontal line.
I've tried fixing the code, but Im really stumped. Im going to finish the tutorial with the sphere, but would really like to be able to have the tracer bullet effect.

Any Suggestions?

Thanks alot,
Para
Krilik
19
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 16th Nov 2006 05:45
That's because the original game fires a sphere that's width, height, and length are the same so it doesn't need to rotate the bullet in order to make it face the right direction.

In order to get your bullet to fire correctly you'll need to rotate the bullet by the angles the player is facing on the Y and X axis.

I don't have the tutorial code, but you will need to get the angle of the player using object angle x() and object angle y() every loop. Store those into variables and then when you create your bullet call the command rotate object with the values stored in the variables.
Parapsycho
18
Years of Service
User Offline
Joined: 15th Nov 2006
Location:
Posted: 16th Nov 2006 20:46
Thanks for the reply.

I tried implimenting the change you suggested, but I still got the same results I might try approaching the problem a different way, i.e scaling the box as it's being fired and seeing if that fixes it.
Krilik
19
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 17th Nov 2006 22:45 Edited at: 18th Nov 2006 04:40
Well I took a look at the code and you're right the way I suggested wouldn't work. Its strange though because the code calls set object to camera orientation when the bullet is created, so it should be aligning itself with the way the camera is facing. I'm actually quite stumped.

Edit: I must have been tired or something. I went and took a look for you again and realized what was going on. The camera is being manipulated using the Yrotate and Xrotate commands, I figured the set object to camera orientation would align the object to the camera's angles. But then I remembered the camera uses ZYX rotation while objects use XYZ rotation. So even though the angle is correct the rotations will be screwy because they are reversed. To fix it just call set object rotation zyx before you main loop on your bullet object. The set object to camera orientation will do the rest

Login to post a reply

Server time is: 2025-05-26 03:26:24
Your offset time is: 2025-05-26 03:26:24