Is it possible to return a float from the cmd:

Community Forums/General Help/Is it possible to return a float from the cmd:

Blitzplotter(Posted 2009) [#1]
I am attempting to create a pivot for some smoke that needs to be attached to a funnel. For testing purposes I have just attached a funnel to a car. I am using the dBodyGetPositionX, Y & Z respectively however I am only able to return integers. I require more precision in order to place my smoke dynamically on top of the funnel.

Can anyone please tell me if it is possible to return a float from the following dBodyGetPosition{X,Y,Z} argument ?

funnelx=Float dBodyGetPositionX(Car)
funnely=dBodyGetPositionY(Car)
funnelz=dBodyGetPositionZ(Car)


Thanks in advance - BP.


Blitzplotter(Posted 2009) [#2]
I seem to have found a workaround which ties my smoke to my funnel:




GfK(Posted 2009) [#3]
Not entirely sure where that function comes from, but you can get a function to return a float by sticking a hash (#) at the end of the function declaration, i.e.:
funnelx=dBodyGetPositionX(Car)

Function dBodyGetPositionX#(entity)
   ;whatever the function is
   Return value#
End Function


Note that further modification may be required if the existing function only operates with integers.


Blitzplotter(Posted 2009) [#4]
thanks for the feedback Gfk.


Nate the Great(Posted 2009) [#5]
try tform point. im not sure exactly how this works but it worked for me when I used blitz 3d


D4NM4N(Posted 2009) [#6]
In addition to what gfk already wrote, if the first line of this is the first occurance (ie a declaration) you need a # on the end of that too.

ie;
funnelx#=dBodyGetPositionX(Car)

Although not nessecary i prefer to try and remember to use %#$ for int/float/string declarations and in complex formulas. Also i try and use them throughout, especially # and $, that way i know exactly what they are and because blitz3d does not have stricts(shame!) it helps stop math errors.

eg:
funnelx=dBodyGetPositionX(Car)
funnelx#=funnelx#+10

would throw an error telling me i screwed up on the declaration.