rolling coin

I still can’t get my coin to roll. I can spin it, tweak it, attach it to a path, but cant figure out how to make the coin look like it is rolling accross the floor.

My goal is to have the camera follow a path(i can do that) that follows along with the coin rolling accross a hard wood floor.

When I rotate it along the x axis, it spins, y axis makes it tumble, z axis makes it rotate like a planet.

Also, I am trying to make it rotate 360 degrees, it does half the rotation then doubles back on itself. Do I have to set my key frames at 175, then rotate it again from there?

What is the solution? Help please.

There’s a script by Klopes called “Rotlopes” that does the rotation automatically.

%<

You could do that with Bullet physics engine. It is possible to record the game physics to IPO.

I downloaded the Rotolopes blend file, how do I run the script or get the script into another blend file with my coin? Do I copy the script and put it in my scripts folder?

Open a Text window and Alt-S to save it to the file you want. If it has the BPY! code at the top it will register in the Scripts Menus after you click Update in that menu, otherwise you’ll have to load and run it in a Text window with Alt-P.

%<

didn’t Erwin Coumans say something in the affect that torque forces weren’t implemented? Maybe this is what is happening here?

I changed the script and added a BPY, how do I make it work? Here is the script:

#!BPY
“”"
Name:‘Rotation’
Blender:240
Group:‘Object’
Tooltip:‘rotate object’
“”"

import Blender
from math import pi,sqrt,cos,atan2,asin

X,Y,Z=0,1,2

EJE=Y
PREFIX=‘Roll’

def mat2euler(mat, size): # Algoritmo de eeshlo
scale = [0.0, 0.0, 0.0]
if size[0]!=0.0: scale[0] = 1.0/size[0]
if size[1]!=0.0: scale[1] = 1.0/size[1]
if size[2]!=0.0: scale[2] = 1.0/size[2]
angle_y = -asin(mat[0][2] * scale[0])
C = cos(angle_y)
if abs(angle_y)>1.0e-10:
C = 1.0/C
angle_x = atan2((mat[1][2] * scale[1]) * C, (mat[2][2] * scale[2]) * C)
angle_z = atan2((mat[0][1] * scale[0]) * C, (mat[0][0] * scale[0]) * C)
else:
angle_x = 0.0
angle_z = -atan2((mat[1][0] * scale[1]), (mat[1][1] * scale[1]))
return [angle_x, angle_y, angle_z]

def gtLoc(object):
mtx = object.matrix
return (mtx[3][0], mtx[3][1], mtx[3][2])

def ProdVectZ(v,w):
return v[0]*w[1]-v[1]*w[0]

for o in Blender.Object.Get():
if o.name[:len(PREFIX)]==PREFIX:
sc=Blender.Scene.getCurrent()
print “Processing object”,o.name

	RADIO=o.size[2-EJE]

	try:
		oBuff=Blender.Object.Get('.Buff.'+o.name)
		print "	Recovering buffer info..."
		L=oBuff.getLocation()
		L0=L[0],L[1],L[2]
		L=gtLoc(o)
		oBuff.setLocation(L[0],L[1],L[2])
	except AttributeError:
		oBuff=Blender.Object.New('Empty')
		oBuff.setName('.Buff.'+o.name)
		print"	Empty buffer not exist. Creating..."
		sc.link(oBuff)
		L=gtLoc(o)
		oBuff.setLocation(L[0],L[1],L[2])
		L0=oBuff.getLocation()

	L1=gtLoc(o)
	V=L1[0]-L0[0],L1[1]-L0[1],L1[2]-L0[2]
	esp2=V[0]**2+V[1]**2+V[2]**2
	ang=sqrt(esp2)/RADIO

	s=ProdVectZ(o.mat[EJE],V)
	if s&gt;0: ang=-ang

	if EJE==0:
		o.RotX+=ang
	elif EJE==1:
		o.RotY+=ang
	elif EJE==2:
		o.RotZ+=ang

Open the Rotlopes.blend again and scroll to the top of “Rotlopes2.0G” (there are actually 4 scripts, 1 of which has to go into ScriptLinks after defining the Axis, Radius and renaming the Object’s Prefix) to read instructions.

WARNING: This script will only work with Python 2.3.x and Blender 2.28 to 2.37a.

%<

When I rotate it along the x axis, it spins, y axis makes it tumble, z axis makes it rotate like a planet.

I’m not sure what you mean by “rotate like a planet” as opposed to spin, but if you mean rotate like a planet rotates around the sun, then part of your problem may be that your object’s center isn’t in the right place. If this is true, go to edit mode, select all vertices, click shift-s and choose “cursor --> selection” then go to object mode under Mesh and click “Centre cursor”.

Basically, you should be able to rotate the coin in a rolling direction. I’m assuming that the scripts mentioned here are for doing things like matching the rotation speed with the movement along the path, for realistic (non slidey) rolling.

I made a demo blender-file for you with a rolling coin, wich was really simple (without any scripting etc., only by keyframing), but sorry, I seem to be not allowed to upload anything here.

You can upload it here:

http://blender.isoserv.com/

%<

Maybe a bit off topic, but this is one of those ‘must see’ animations. It goes about spinning:
http://www.tysonibele.com/Main/CAGS_dvx.avi

Thanks for all the help. This forum is awwesome. Anyway I figured out that I can create an empty, and animate it on its y axis. I can loop the rotatin by setting the curve setting to extrapolation. I then set a contraint of ‘copy rotation’ on the coin object to the empty.

I can then animate the coin object along a path.

Here is the rough draft, still needs alot of work, but the rolling thing is solved:

http://www.leifsweb.com/coinroll.mp4

Thanks once again.