Crimsonfox
12-12-2010, 06:07 PM
I've got this
on roll open do
(
(when transform $b changes id:#shipMove do
(
if chk1.checked == true then
(
posPos = [$b.pos.x, $b.pos.y, $b.pos.z + 1000]
Uray = ray posPOS [0,0,-1]
IUray = intersectRay $p Uray
if IUray == undefined then ( print "bleh" )
else (
$b.pos = IUray.pos
norm = -IURAY.dir
rightVector = normalize(cross IUray.dir Norm)
upVector = normalize(cross rightVector Norm)
q = matrix3 rightVector upVector Norm [0,0,0]
rotate $b q.rotation
print q.rotation
)
)
)
when transform $p changes id:#surfaceMove do
(
if chk1.checked == true then
(
posPos = [$b.pos.x, $b.pos.y, $b.pos.z + 1000]
Uray = ray posPos [0,0,-1]
IUray = intersectRay $p Uray
if IUray == undefined then ( print "bleh" )
else(
$b.pos = IUray.pos
norm = -IURAY.dir
rightVector = normalize(cross IUray.dir Norm)
upVector = normalize(cross rightVector Norm)
q = matrix3 rightVector upVector Norm [0,0,0]
rotate $b q.rotation
print q.rotation
)
)
)
on roll close do
(
deleteAllChangeHandlers id:#shipMove
deleteAllChangeHandlers id:#surfaceMove
)
Problem is it doesn't do the same thing. $b is the box I want to move along the surface $p being the surface. I want it to move along the surface when either are moved. It does it fine when $b is moved just not $p, the rotation seems to be rotating the opposite way.
any help would be great, cheers.
on roll open do
(
(when transform $b changes id:#shipMove do
(
if chk1.checked == true then
(
posPos = [$b.pos.x, $b.pos.y, $b.pos.z + 1000]
Uray = ray posPOS [0,0,-1]
IUray = intersectRay $p Uray
if IUray == undefined then ( print "bleh" )
else (
$b.pos = IUray.pos
norm = -IURAY.dir
rightVector = normalize(cross IUray.dir Norm)
upVector = normalize(cross rightVector Norm)
q = matrix3 rightVector upVector Norm [0,0,0]
rotate $b q.rotation
print q.rotation
)
)
)
when transform $p changes id:#surfaceMove do
(
if chk1.checked == true then
(
posPos = [$b.pos.x, $b.pos.y, $b.pos.z + 1000]
Uray = ray posPos [0,0,-1]
IUray = intersectRay $p Uray
if IUray == undefined then ( print "bleh" )
else(
$b.pos = IUray.pos
norm = -IURAY.dir
rightVector = normalize(cross IUray.dir Norm)
upVector = normalize(cross rightVector Norm)
q = matrix3 rightVector upVector Norm [0,0,0]
rotate $b q.rotation
print q.rotation
)
)
)
on roll close do
(
deleteAllChangeHandlers id:#shipMove
deleteAllChangeHandlers id:#surfaceMove
)
Problem is it doesn't do the same thing. $b is the box I want to move along the surface $p being the surface. I want it to move along the surface when either are moved. It does it fine when $b is moved just not $p, the rotation seems to be rotating the opposite way.
any help would be great, cheers.
