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 / Problem with limb direction()

Author
Message
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 3rd Dec 2003 17:18
I am moving a tank on a matrix, tilting it with the matrix and i want to get the x,y,z angles of the barrel, to shoot my bullet in the right direction, it is a limb of the tank and i use the Limb Direction command and it returns weird angles that are wrong.

Anyone ever had that problem ???

PS I am using a model from the dark matter collection.
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 4th Dec 2003 03:04
huh, anyone....
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 4th Dec 2003 05:59
My question is: How do you shoot a bullet out of a canon that is on a tank that moves on a matrix. The canon is a limb of the tank and the limb direction command DOES NOT WORK. please anyone....
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 4th Dec 2003 06:10
you're probably using the wrong limb functions

check over the limb functions but you're lucky hoverfrog because i was just working with the limb functions and was doing some pretty neat stuff. First off dont use the limb direction command. Use the limb angle command because you can minapulate it using the rotate limb command along with wrapvalue and curveangle. Then the bullets angle to the limb angle.

(example)
do

tbax#=limb angle x(1,1)
tbay#=limb angle y(1,1)
tbaz#=limb angle z(1,1)
(the first number is the object number and the second is the limb number)

bulletax#=object angle x(2)
bulletay#=object angle y(2)
bulletaz#=object angle z(2)

if rightkey()=1 then tbay#=wrapvalue(tbay#+5)
if leftkey()=1 then tbay#=wrapvalue(tbay#-5)

rotate limb 1,1,0,tbay#,0
(that part of the code will rotate the limb when the left or rightkey is pressed)

(now you must set the bullets angle and position based on the limb)
(just use the limbs angle and it will return the right angles for you, if you need more code feel free to ask, remember use the limb angle functions instead of limb direction)

loop
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 4th Dec 2003 06:35
Thanks Clarks for your reply.
My problem is that Limb Angle will return The angle between the new limb angle and the original angle of that limb. Ex: If the limb is a canon, if i rotate that limb, limb angle will return that angle. What I want is the angle of that limb between the the x,y,z of the world coordinate which i thought limb direction would do according to the book but it does not...
Your help is appreciated, maybe i am missing something...
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 8th Dec 2003 18:31
Well if any of you is interrested I solved the problem by adding a limb at the tip of the canon and made it child of that canon and did the following calculations to determine the displacement of the bullet over the X,Y,Z axis (You can later decrease the value of dx# as the bullet goes to simulate gravity)

[ BX# = Limb Position X(Tanknum,5)
BY# = Limb Position Y(Tanknum,5)
BZ# = Limb Position Z(Tanknum,5)
TipX# = Limb Position X(Tanknum,6)
TipY# = Limb Position Y(Tanknum,6)
TipZ# = Limb Position Z(Tanknum,6)
Lgt# = sqrt((TipX#-BX#)^2 + (TipY#-BY#)^2 + (TipZ#-BZ#)^2)
Velocity = 20
dx# = Velocity*((TipX#-BX#)/Lgt#)
dy# = Velocity*((TipY#-BY#)/Lgt#)
dz# = Velocity*((TipZ#-BZ#)/Lgt#)]
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 8th Dec 2003 18:34
PS. Could anyone explain to me how to add that Code Snippet button on a post...
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 8th Dec 2003 18:52
press the CODE button, then when your done, press it again

or type
[*code]
type your crap here
[/*code]

but remove the stars

=<=Pudgie Wars=>=
Game engine: 20% = Models: 25% = Textures: 1% = Sounds/Music: 0% = www.geocities.com/bigapple_entertainment
HoverFrog
21
Years of Service
User Offline
Joined: 7th Aug 2003
Location: Canada
Posted: 8th Dec 2003 23:07
Thanks...

Login to post a reply

Server time is: 2024-11-11 01:37:19
Your offset time is: 2024-11-11 01:37:19