Is it possible to disable gravity in the physics engine? Or set it to a weaker force?
I get nil when I try to read craft.physics.gravity (and also for paused) and trying to set it doesn’t work. I’ve tried applying a countering force, but continually applying a force makes physics stop after a short time (which presumably shouldn’t happen).
@dave1707 I don’t know any other way to describe it than saying it just stops. Everything stops moving, but no errors.
Try this, the block should move in a circle.
-- CraftPhysics
function setup()
scene = craft.scene()
local e = scene:entity()
e.model = craft.model.cube(vec3(1,1,1),vec3(0,0,0))
e.material = craft.material.preset("Surfaces:Basic Bricks")
scene.camera.z = -15
scene.physics.gravity = vec3(0,0,0)
r = e:add(craft.rigidbody,DYNAMIC)
end
function draw()
r:applyForce(vec3(math.sin(ElapsedTime),math.cos(ElapsedTime),0)/4)
scene:update(DeltaTime)
scene:draw()
end
In a default project it can be turned off for an individual physics object by adding
.gravityScale = 0 after youve created a physics object.
for example
But gravityScale doesn’t seem to work with a Craft Project, its also not in the documentation either. Kinematic bodies don’t collide with anything. And Static only collides with Dynamic bodies which brings us back to square one.