I'm trying to find a way to orient a facing card in a particle system to be always facing camera but be orientated to be parallel to the camera as well. So the bottom and top edge of the facing card matches that of the camera.
Forum topic · General Scripting
Particle Orientation
By JokerMartini · 2012-05-22
Description
Comments (5)
Hope this help
barigazy · 2012-05-22
pfSys = ($PF_Source_001)
count = pfSys.NumParticles()
theTarget = $Camera001 -- the target
for p = 1 to count do
(
local dum = dummy()
pfSys.particleIndex = p
pPos = pfSys.particlePosition --get particle pos
tm = matrixfromnormal theTarget.dir --get the camera matrix3
new_TM = matrix3 tm.row1 tm.row2 tm.row3 pPos
dum.transform = pfSys.particleTM = new_TM
)
SOLUTION
JokerMartini · 2012-05-22
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useSpeed = true
pCont.useTM = true
pCont.usePosition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
source = $Camera001
for i in 1 to count do
(
pCont.particleIndex = i
tm = source.transform
pos = pCont.particlePosition
new_TM = matrix3 tm.row1 tm.row2 tm.row3 pos
pCont.particleTM = new_TM
)
)
Maybe
barigazy · 2012-05-22
I think is better to use
matrixfromnormal source.dirthen
source.transform
JokerMartini · 2012-05-22
I essentially want the particles to act as if they had an Orientation constraint on them so that they are always facing camera but also have the rotation to be parallel on all sides to match that of the camera.
I tried this but its way to intense to do on large particle counts and actually doesn't orient the particles correctly.
pfSys = ($PF_Source_001)
count = pfSys.NumParticles()
for p = 1 to count do
(
local dum = dummy()
local theTarget = $Camera001 -- the target
pfSys.particleIndex = p
pPos = pfSys.particlePosition --get particle pos
tm = theTarget.transform --get the camera matrix3
new_TM = matrix3 tm.row1 tm.row2 tm.row3 pPos
pfSys.particleTM = new_TM
)
barigazy · 2012-05-22
Please, screenshoots if you don't mind.