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.

Newcomers DBPro Corner / Shooting where Helicopter is pointing to

Author
Message
Sakuya
15
Years of Service
User Offline
Joined: 16th Feb 2009
Location: IB*ET
Posted: 2nd Dec 2009 03:39
Hello

Im trying for hours to find out how my Helicopter could shoot in the direction it is pointing to.
I tried to use Dark Physics Raycasting but im getting more and more confused. I also searched alot but i do get the idea behind it but when Im trying to code it I realize that still nothing has changed.


The Idea is:
The Helicopter got a Gun an when I click it shoots. Until here everything works fine. BUT what im trying to rotate the Helicopter and shoot afterwards it still shoots strait.

I thought something like this:

Object 1 is my Helicopter and 6 is a Plain with Dusteffect on it.
Orion1024
15
Years of Service
User Offline
Joined: 7th Mar 2009
Location: Dimensional Coordinates: 323.935.914.157
Posted: 2nd Dec 2009 07:20
The easiest thing to do would be to add a hidden limb to the helicopter to set the start position and angle of the bullet. When you fire, position the bullet where the hidden limb is and use the limbs angle. The limb can be small box.

Looking for the vortex to another Earth
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Dec 2009 14:07
you donĀ“t need Dark Physics to do that.Try this:



learning every day
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 2nd Dec 2009 19:18
Have you read the syntax for the command at all? One look in the help files tells you that the raycast command requires two 3D positions set as it's parameters. The first three parameters are the x/y/z location of it's starting point, and the second three are the x/y/z location of it's ending point. You're putting your helicopter's position as the ray's starting point, and then setting the global position 0, 0, 1 as it's end point. Obviously then, the ray will always be sent out towards coordinates 0,0,1. The ending coordinates would logically need to be a position directly in front of your helicopter's gun, at a specified distance.

You can figure out a 3D position in front of another object by either adding a limb to the object and offsetting it to the distance you want and just retrieving it's position data, or you can use the newvalue commands to achieve the same effect. Look the newvalue commands up for more information.
Sakuya
15
Years of Service
User Offline
Joined: 16th Feb 2009
Location: IB*ET
Posted: 2nd Dec 2009 21:22
@ RUCCUS

Yeah I read it not only once and I also searched the forum
its just when I use it like this and a wall is infront of the Heli it hits it otherwise when I use other XYZ for ending it won't hit anything at all even when I put the Position infront/on/behind the wall so I got confused.

I tried the Newvalue functions and yeah they worked out pretty well thanks alot

@ chafari

yeah I know but i thought it would give me maybe some benefit
I also heared that those set to orientations are kind of bugged and it would be better not using them
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Dec 2009 14:10
Quote: "I also heared that those set to orientations are kind of bugged.... "

could you show your complete code?...maby it can help

learning every day

Login to post a reply

Server time is: 2024-09-28 12:15:44
Your offset time is: 2024-09-28 12:15:44