View Full Version : orbiting expression
bendingiscool 01172008, 03:25 PM Hey guys, I am just starting to get into Expressions, well object based expressions anyway, I have a bit of experience with particle expressions.
Anyways, I was wondering how I would make an object orbit another object, and how I would get it to maintain a constant distance if the object being orbited was moving.
Any ideas would be much appreciated!!
Chris


Gravedigger
01172008, 04:03 PM
well you can just put the pivot of the orbiting object to the object in the center and do some rotations.
if you'd like to put in some maths you can use sine and cosine functions or matrix multiplications, whatever :D
but i think the easiest way would be to use the pivot
tbaypaul
01172008, 05:09 PM
This does it...
polySphere r 1;
polySphere r 0.25;
expression s "float $orbitRad1 = 5.0;\r\nfloat $orbitRad2 = 2.0;\r\npSphere1.translateX = $orbitRad1 * sin(deg_to_rad(4*frame));\r\npSphere1.translateZ = $orbitRad1 * cos(deg_to_rad(4*frame));\r\npSphere2.translateX = pSphere1.translateX + $orbitRad2 * sin(deg_to_rad(16*frame));\r\npSphere2.translateZ = pSphere1.translateZ + $orbitRad2 * cos(deg_to_rad(16*frame));" o pSphere1 ae 1 uc all;
playbackOptions min 0 max 360 ;
but expressions are the slowest way....I agree with the pivot idea.
CGTalk Moderation
01172008, 05:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002014, Jelsoft Enterprises Ltd.