setMass function?

In python is there such a command to setMass? I would imagine I would use Rasterizer.setMass(value) but this isn’t working. Not sure if this is possible. I’m working on a demo python package for blender that allows you to “defy” the laws of gravity by using dynamic particles and force fields.

Anyway I hope you can come up with a solution.

Wait, the mass has nothing to do with gravity… how do I set the gravity for only one object?

o for just one object idk but you can change the xyz gravity
u use

gravity = [x, y, z]
#not sure if its gamelogic
GameLogic.setGravity(gravity)

this is fun to play around with but it sets the world gravity
you could just have a motion actuator and put different forces on the object. i think this acts like gravity if you use force.

Yea, that would work, but setting up the control scheme and actuator on each object would not be worth the trouble.

However, if you use “applyImpulse()” it can turn out to be relatively manageable.

Here, I made an example:

Attachments

object_gravity.blend (135 KB)

Thanks for your time social, I’ll check it out. Is that method “cheating” or actually setting individual gravity? I know I could use force but when I have 100 different dynamic falling objects it turns into a pain in the ass.

Wow social! Great work! Now how would I go about adding mouse tracking to it? (Like force grab [SW ftw])

Would I get mouse posi and set it to something like mouseposi (variable) and then set the gravity to the xy of mouseposi?

Not sure how I would go about this. I always use the Blender Python API site for references, but I’m not sure how to split the mouseposi to xy in the format that gravity could read.

EDIT:: also do you have to have glsl to use the enableMotionBlur function?

Omgz this is frustrating… I’m trying to get the cube to follow the mouse when I set the mouse over the cube. Here’s my file:

Attachments

PyPhy.blend (132 KB)

well there are some errors but the mouse position is the position on the screen and it says the upper left corner is 0, 0 and the middle was like 500 or something so when you set the position it is setting it 500, 500 which is way off the screen
an error is its setPosition() not setLocation() and i think you need to use a variable in the parentheses so you will put
pos = [posx, posy, 0]
cube.setPosition(pos)

edit you might want to look at some custom cursor files i think it will help

edit: now the cube goes right in front of the camera but it would follow the mouse if it didn’t i think so see if you can get it to work
oh yea nice property hi lol thats what i call my properties when i cant think of anything :smiley:

yet another edit: im not sure why but it always says the mouse position is
[-1.5821574296728091, -23.507938155748946, 0.42386997320602238]
this is frustrating

Attachments

PyPhy.blend (133 KB)

Haha yea ownd.hi =]

lmao that was a nerdy joke. I just ownd.kkewly =]

haha. Anyway I thought it was obj.setLocation. Anyway I’ll try it out now.

Would you like to donate any of your physic demos (if you have any) to the PyPhy (the library I’m making) PyPhy is Python Physics.

hey i just thought of something you can use blenderenzo’s custom cursor script and use that cursor and then when you mouse over it parents the cube to the cursor.

That could work, I’m trying to do something like when you hover you “grab” it and then you can throw it (for rag doll physics)

o well it didn’t work anyway the cube disappeared
i dont have any physics demo’s right now

It doesn’t work =/ I’m not sure what to do.