Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 21-09-2013 , 01:30 PM
black H's Avatar
Someone that likes Maya but suffers to master it :p
Join Date: Sep 2013
Posts: 10

Bullet physics MEL expression HELP!!

Hi

I have a ball in maya bullet physics, I want its velocity in (x) direction to have a certain value (-5 for example) but at frame 100

I wrote an expression for that but maya gives me error message for it:

//Error:attributes must be of float,integer , or boolean types:

what did I do wrong? is this expression correct?

if (frame <100)
bulletRigidBodyShape1.initialVelocity = << 0 , 0 , 0 >>;
else bulletRigidBodyShape1.initialVelocity = << -5 , 0 , 0 >>;


screenshot here if needed..
https://img102.imagevenue.com/img.php..._122_404lo.jpg

user added imageuser added image


Last edited by black H; 21-09-2013 at 01:31 PM. Reason: correcting
# 2 21-09-2013 , 02:09 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Try initialVelocity.x = -5 so it's not a vector.

# 3 21-09-2013 , 02:36 PM
black H's Avatar
Someone that likes Maya but suffers to master it :p
Join Date: Sep 2013
Posts: 10
Hi,
Yes I tried as you said bulletRigidBodyShape1.initialVelocity.x= -5;
but It gave me the same error:
//Error:attributes must be of float,integer , or boolean types:

Am not sure if the intial velocity inside bullet physics is a vector

also my MEL knowlge is soo poor, I don't have experience with , I just copy past mel codes from the net to maya user added image


I need it cause I want to make the velocity work after a certain frame in the simulation and not from the begnning


Last edited by black H; 21-09-2013 at 02:38 PM. Reason: correction
# 4 21-09-2013 , 09:27 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
You'll have to use the "setAttr" command in this case and specify what kind of data. This attribute takes three float values, it's easy to find out just enter this into the command line:

Code:
getAttr -type bulletRigidBodyShape1.initialVelocity;
and the result will be:

Code:
// Result: float3 //

Using the type flag ensures Maya won't misinterpret the code and throw a syntax error

Code:
if(frame<100)

	setAttr bulletRigidBodyShape1.initialVelocity -type float3 1.000 2.000 3.000;
else 
	setAttr bulletRigidBodyShape1.initialVelocity -type float3 0.000 0.000 0.000;

Hope that helped.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 5 22-09-2013 , 11:35 AM
black H's Avatar
Someone that likes Maya but suffers to master it :p
Join Date: Sep 2013
Posts: 10
@ Gen , wow your method works user added image

yes I tested it, and it's working,, this is a great help here, thank you user added imageuser added image

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads