How do I link a wheel to a base?

Godot Version

4.3

Question

Help Programming Physics
I’m making a game where you have to build a robot made of various components, and one of these components is a wheel.
I need to make sure that the wheel stays fixed to the center of the block, but still works as a wheel during the game.

image image

I have a base and a wheel, and I have to make sure that the wheel stays centered to the base.
I tried doing this inside the wheel script:

extends RigidBody2D

func _process(_delta: float) -> void:
	global_position = get_parent().get_node("block").global_position

But it just makes the wheel phase through everything while being attached to the base.
I need to make sure that the block is responsive to what the wheel is colliding with, so that the wheel is able to roll.

Both of these components are in the same scene, here is the tree:
image

Any help is appreciated, thanks in advance.

Try a PinJoint2D, joints are used to contrain physics objects together.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.