Notifications
Clear all

[Closed] rolling cube

You could just give it a constant horizontal velocity and make the angular rotation constant as well. Then you just need a function to determine the elevation with respect to the rotation. So, if you’re rotating from 0 to 9999 by 15 deg for example, first say

r = rotation mod 90

you know that when r = 0 or 90 the height should be unchanged (length/2). When r=45 the height should be length/sqrt(2).

So if we modify a sin curve to fit within these bounds you get

y = sin(r*4-90)/2+0.5

but this gives y as 0 to 1, we want it to vary from 0 to (length/sqrt(2)-length/2) so just multiply it by that

http://www.harmmaaktmooi.nl/sample/roll.max

i made the cube. and when you move it in the x-axis. Its roll’s. this part is ok.
did it in wire-parameters.
can someone plz show me how to make the sinus thingie.
is this doable in wire-parameters or do i need expressions?

Aeron your absolutely right. It isnt a sin, cos or whatever.

i made the movement and it comes to this. Is this doable or is it real hard?

this is surely done with animation not script!!?!? I’d use a splineIK (see attached MaxFile)

If it absolutely came down to scripting it then I would transform the vertices around the relative axis (defined by two corner vertices!) using matrixes. When that was rotated, I’d then move to the next axis and then rotate the next set. does this make sense?

Anyway, plenty of hidden pitfalls, the IK is much better,

no its animation. Just to show that the movement isnt a sinus as i thought.

 eek

Its not a sin wave ,its more zizzag or bounce, i.e fast in-out. Reminds me a lot of bezier segments. Hmm… i think i have an idea.

cant this movement be done in an expression. so that when i move the cubes its rolls.
i would be happy with only the bounce Z-movement. then i can desect and make my own expressions.

tnx

 eek

Yes but the bounce is the hard part, one side not is that the x positon is product of both the bounce and rotation, but i more the bounce i think.

Or the rotation.

i think i have it. it is a sine wave, but only a part of it

the calculations in this thread so far use a sine wave from 0 to 180, the cube only goes from from 45° to 135°, so we just need that segment of the sine

1 Reply
 eek
(@eek)
Joined: 10 months ago

Posts: 0

yes we could use a full wave rectified sine to achieve this. It wont take into accout slding though. Its one thing to keep the box on the ground plane another to sync to rotation to the wave. bernstien would acheive the same result.

The equation for full wave is: f(t) = (2a/pi – 4a/pi) sum cos(ninf1t)

‘a’ being the height and ‘t’ iteration.

This is part of the ‘fourier’ series.

Edit: sorry that equation is wrong, i need to factor in sigma.

this one is more accurate, i used some circle formulas instead of sin:

( )


 len = 20
  r = sqrt (2*len^2)
 
  rot = abs (radToDeg Y_Rotation)
 rot = mod rot 90 + 45 -- with this rot will always be between 45 and 135, which is the segment of a full circle the box's center traverses
 
 -- straight from wikipedia formula
 a = cos (abs rot) * r
 
 g = a/(tan rot)^1
 
 g = g/20*8.2843
 

what we remains is some slipping, we can get rid of that as well though. ‘a’, which we calculated based on the current rotation, gives us the position the corner of the cube ‘should be at’ at any given time, we can use this to apply an offset to the position using a list controller for example

Page 2 / 4