PDA

View Full Version : Basic Maths/Vector problem.


DaveWortley
04-06-2009, 02:11 PM
I'm trying to write a script which would effectively link one object to another, but not using any constraints.


A want it so when I rotate Object A, Object moves accordingly and rotates as well just as a simple link constraints would do. Getting muddled up in some trig at the moment and I'm sure there's a simple way to do it using Vector Maths that I'm not familiar with.

j-man
04-06-2009, 02:13 PM
Hi Dave,

Can't you use parameter wiring or the reaction manager for this? I suppose a script controller would do it.

J.

phoelix
04-06-2009, 02:31 PM
3d hierarchies use this equation:

T=L*P

where P is the parent's transform matrix, L is the local transform matrix and T is the resulted matrix.

DaveWortley
04-06-2009, 04:41 PM
@ j-man - Can't use wiring as I'm planning on converting this to a particle system to try get groups of particles rotation around helpers.

@phoelix - Thanks, thought there must be something simple along those lines...

Hopefully I can get it working on a particle system as well! Cheers

D

DaveWortley
04-06-2009, 06:31 PM
I've got this working with a particle flow but it just rotates each particle locally, how do I get it to move the particles as well? Do i have to get the transformation matrix of the particle flow as well?

on ChannelsUsed pCont do
on ChannelsUsed pCont do
(
pCont.useage = true
pCont.useMatrix = true
pCont.useTM = true
)

on Init pCont do
(

)

on Proceed pCont do
(
count = pCont.NumParticles()

for i in 1 to count do
(
pCont.particleIndex = i
if pCont.particleAge == 0 then
(
--store original transformation matrix
pCont.particleMatrix = PCont.particleTM
)
else
(

pCont.particleTM = ($Point01.transform * pCont.particleMatrix)

)
)
)

on Release pCont do
(

)

CGTalk Moderation
04-06-2009, 06:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.