+1 vote

I have been trying to make it so that I can create a cube and it will attach to whatever is passed into the function. But when I run it everything works fine, I can make towers of blocks, they collide, all of that but the joint doesn't do anything. I have tried various methods of creating and attaching the joint but nothing changes, I am not even getting errors.

Anyone have any idea what could be wrong?

#position = the position of new object, baseObject = a referance to the object that this 
one will be attacthed to.

func createObject(position,baseObject):
 position = position.snapped(Vector3(1,1,1)*gridScale)
 var object = RigidBody.new()
 var collision = CollisionShape.new()
 collision.shape = BoxShape.new()
 collision.shape.extents = Vector3(0.5,0.5,0.5)
 object.translation = position
 var objectCSG = CSGBox.new()
 objectCSG.width = 1
 objectCSG.height = 1
 objectCSG.depth = 1

 var joint = Generic6DOFJoint.new()


Sorry about the weird indenting, but the text wrap is messing with it.

Godot version 3.3
in Engine by (573 points)

As a side note, it's recommended to avoid using CSG nodes when you're not performing boolean operations as their UV mapping is less flexible. Instead, use a MeshInstance with a CubeMesh resource assigned to its mesh property (this can be done via code too).

1 Answer

+1 vote
Best answer

Don't know why but replacing the code that adds the joint with this fixed it.

var joint = Generic6DOFJoint.new()
by (573 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.