Notifications
Clear all

[Closed] need a simple script to limit object pos depending another objects pos

I’ll try to explain this as easy as possible, lets say we have a square and a sphere, these objects are connected to other objects and cant be parented as it would create a dependancy loop (float limit out of the question then),

the position of the sphere should be limited to the position of the square, so lets say the sphere can move a distance of 50 in x,y,z from the squares position. How can I do this not using a float limit?

12 Replies

is it something like this

if sphere.zpos > (square.zpos + 20)
then sphere.zpos = maxPos

…bump…

 PEN

I”m betting you can use a float limit. You would need to set a script controller on the min/max values that references the object that is to drive this and calculate what the min/max values need to be.

I understand what your saying, not too sure how to set it up (im a noob) but I have a general idea, so I’ll give it a go and post back if I have any problems, hey thenx man

ps: is the pen attribute holder script yours? if so, its really awesome man, I love it, and thanx.

 PEN

Yes it is, and ,your welcome.

3 Replies
(@redwatty)
Joined: 11 months ago

Posts: 0

wow u know your stuff, that script really rocks, probably the best I have ever used.

I don’t have much experience in scripting yet, but have used max for years, so I have somewhat of an understanding, but I get stuck quickly at the minute doh.

I’ve started on the script, am sort of learning as I go, but heres what I have

$Sphere01.position.controller=position_script()
$Sphere01.position.controller.script = “$Box01.pos – [10,10,10]”

fs = floatLimitCtrl()
$Box01.pos.controller = fs
fs.lower_limit = -10
fs.upper_limit = 10

Once executed I get an error

Controller:Position_Script
“$Box01.pos = [10,10,10]”
Controller:Float_Limit
– Runtime error: Incompatible controller type for property: position
-10
10

am I going in the right direction? and how can I fix the error?

(@robgalanakis)
Joined: 11 months ago

Posts: 0

Psssht, yeah he knows his stuff, you see that jacket?

(@redwatty)
Joined: 11 months ago

Posts: 0

I want one lol

ahh i needed to add $Box01.pos.controller.x_position.controller = fs

arghhh man I’m lost, totally lost,

all I wanna do is finish off this rig : http://terminatorproject.com/trialrig.zip

If you play with the main foot controller you will notice if its pulled to far the toes seperate from the foot, have I rigged this ok upto now?

all I wanna do is to stop the toes seperating, my logic was to limit the controllers position depending on the foot position, but my maxscript skills are not good, is there any other way I could do this? even if its a different rig?

bump…

…anyone?