maybe in python? How?
I’m not sure that there is a way to do that, however you can make the gravity look higher if you just make everything in your game smaller.
awsome, thanks. Even though that’s not what i asked, you helped me solve the problem.
Glad I could help.
PS: Please change the title to “set gravity above 25 in bullet?[ANSWERED]”.
Lol, even though it says solved… I’ll answer the initial question since others might dig it up in the future. You can set gravity higher than 25 with python.
But be warned that too high of a gravity might not trigger collisions with objects. It’ll just go through. I used 50 because anything over that for me the cube would go through the plane.
import GameLogic as g
g.setGravity([0,0,-50])
Jason Lin
Point Gravity
For planar gravity (Blender GE gravity), simply
use one (Z-axis) component of the vectors to calc gravity
import Blender
from Blender import *
from math import *
import GameLogic
zero_vector = [0.0,0.0,0.0]
set gravity-point to origin
gravity_point = zero_vector
g = GameLogic
In your initialization script place the following line:
g.setGravity(zero_vector)
So that we can use our gravity script below on a frame by frame basis
c = g.getCurrentController()
o = c.getOwner()
mass = 200.0
#mass = o.getMass()
pos = o.getPosition()
Gravity value: 9.81 or whatever.
G = 160.81
Calc vector from object to gravity-point.
subtract pos from gravity-point
gv = [gravity_point[0] - pos[0], gravity_point[1] - pos[1], gravity_point[2] - pos[2]]
calc absolute distance ( based on C^2 = A^2 + B^2 )
d = sqrt((gv[0] * gv[0]) + (gv[1] * gv[1]) + (gv[2] * gv[2]))
calc force of gravity
f = G * mass/(d*d)
apply the force of gravity to the vector to create a
gravity vector
gv = [(f/d)*gv[0],(f/d)*gv[1],(f/d)*gv[2]]
“gvector” is a motion actuator logic brick for this object
fv = c.getActuator(“gvector”)
set the force vector of gravity for this object
fv.setForce(gv[0],gv[1],gv[2],False)
Activate it
GameLogic.addActiveActuator(fv,1)
i dont really get all the maths but what does that do? i think it makes the object go towards a certin point that is the center of gravity? or what does it do
It looks like it makes gravity similar to Super Mario Galaxy: instead of falling towards a plane in the -Z direction, things “fall” towards a point.
cool thats what i thought
could be usefull
Yup, This[thinkofwhy’s code] is a great way to model physical explosions!!
what set it to minus gravity by using
fv.setForce(-gv[0],-gv[1],-gv[2],False)?
i didnt think of that good idea i was using a sphere that expanded and pushed things outwards
That gravity.py code isn’t mine. I found it in this forum somewhere and changed it a bit for my purposes (customized).
So, when I saw this thread I quickly ripped it out to post it here. You should experiment with it and change it for your own uses.
It’s a very useful and powerful bit of code.
The gravity.py script works great, but I can’t get the objects affected by it to collide with the sphere (planet) I have put at the origin for them to be pulled to. They collide with each other there, but just form a weird mass of objects pulled toward the center. If I remove the planet, all the objects get flung off into deep space once they reach the origin, though.