I've been trying to get the wheels to spin at the correct speed when moving the tank control object in various directions. For this I used a base formula and I tried in various ways to extend on it. I was never good at maths in college because I could not actually apply them to a situation I grasped until now. However I am still a bit crap at it but improving :D
With the formula I am trying to have and object look at movement over the x and y axis, and divide this amount by its own perimeter. This works fine over one axis, however if I try to apply it to two axis (x and y) AND a combination of both for angles not 90 degrees, then the trouble starts.
Here are some of the MAXscript formulas I've tried so far (13.400 is the radius of a wheel):
Original
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
(ypos/c)*2*pi)
___________________________________________
2)
dependson $Controller_Tank_Movement.pos.controller
r = 13.400
k = 13.400
c = 2*pi*r
d = 2*pi*k
ypos = $Controller_Tank_Movement.pos.y
xpos = $Controller_Tank_Movement.pos.x
(((sqrt((ypos^2)+(xpos^2)))/c)*2*pi)
__________________________________________
3)
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
xpos = $Controller_Tank_Movement.pos.x
(
if
(
(ypos = 0)
and
(xpos <> 0)
)
then
(
((xpos/c)*2*pi)
)
)
(
if
(
(xpos = 0)
and
(ypos <> 0)
)
then
(
((ypos/c)*2*pi)
)
)
(
if
(
(xpos <> 0)
and
(ypos <> 0)
)
then
(
(((sqrt((ypos^2)+(xpos^2)))/c)*2*pi)
)
)
_____________________________________________
4)
dependson $Controller_Tank_Movement.pos.controller
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
xpos = $Controller_Tank_Movement.pos.x
(
if
(
ypos == 0
and
xpos <> 0
)
endif
)
then
((xpos/c)*2*pi)
(
if
(
xpos == 0
and
ypos <> 0
)
endif
)
then
(((ypos/c)*2*pi))
(
if
(
xpos <> 0
and
ypos <> 0
)
endif
)
then
(
(((sqrt((ypos^2)+(xpos^2))/c)*2*pi))
)
_________________________________________________
5)
dependson $Controller_Tank_Movement.pos.controller
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
xpos = $Controller_Tank_Movement.pos.x
if
(
ypos == 0 \
and \
xpos < 0 \
or \
xpos > 0 \
then ((xpos/c)*2*pi)
)
if
(
xpos == 0 \
and \
ypos < 0 \
or \
ypos > 0 \
then ((ypos/c)*2*pi)
)
if
(
ypos < 0 \
or \
ypos > 0 \
and \
xpos < 0 \
or \
xpos > 0 \
then ((sqrt((ypos^2)+(xpos^2))/c)*2*pi)
)
endif
_____________________________________________
6)
dependson $Controller_Tank_Movement.pos.controller
toolMode.coordsys #local
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
(ypos/c)*2*pi)
_______________________________________________
7)
r = 13.400
c = 2*pi*r
ypos = $Controller_Tank_Movement.pos.y
xpos = $Controller_Tank_Movement.pos.x
if
(
xpos or ypos != 0
then
(ypos)/c)*2*pi)+(-xpos/c)*2*pi)
)
else
(
xpos and ypos != 0
((sqrt((ypos^2)+(xpos^2))/c)*2*pi)
)
endif
_______________________________________________
None of them yield the correct results yet, so I will continue to investigate this further. However I have a big freelance project coming up tomorrow so my time is very limited.