TFORM help

Blitz3D Forums/Blitz3D Programming/TFORM help

Stevie G(Posted 2003) [#1]
I've had a gander at older threads but I can't seem to find much on the subject.

Example ..

I have a mesh which has a pivot parented to it at 0,-1,0 local coordinates. When the mesh is rotated I want to get the x,y & z coordinates of this point relative to the local 0,0,0 point of the mesh. At the moment I just subtract the global coords of the mesh and pivot and this gives me what I need. The results being sort of x,y,z components of a normalised vector.

If this makes sense, the question is .. can I use the TFORM vector / normal / point commands to achieve the same result? If so, can someone show me how to do this?

Cheers


Rottbott(Posted 2003) [#2]
If I understand you correctly that would be:

TFormPoint 0, 0, 0, ThePivot, TheMesh
X# = TFormedX#()
Y# = TFormedY#()
Z# = TFormedZ#()


Stevie G(Posted 2003) [#3]
Thanks for the response Rottbott but I can't seem to get this to work. I think it's returning just local coords - see code below. I take it I can't use the commands like this?

Graphics3D 320,240,16

light=CreateLight()
camera=CreateCamera()

model=CreateCone()
PositionEntity model,0,0,50
ScaleEntity model,4,2,4
EntityColor model,255,255,0

pivot=CreatePivot(model)
PositionEntity pivot,0,-5,0

temp=CreateSphere(4,pivot)
EntityColor temp,255,0,0
ScaleEntity temp,1,3,1

While Not KeyDown(1)

TurnEntity model,1,0,.5

TFormPoint 0,0,0,pivot,model
x#=TFormedX()
y#=TFormedY()
z#=TFormedZ()

RenderWorld()
Color 255,255,255
Text 0,50,"x "+Int(x)+" y "+Int(y)+" z "+Int(z)

Delay 50

Flip

Wend


skidracer(Posted 2003) [#4]
I think TFormVector 0,-1,0,mesh,0 should translate your vector from mesh to global space.


Stevie G(Posted 2003) [#5]
It works!! Thanks alot mate!!