user22692191
user22692191

Reputation: 1

How do I detect for collisions without immediately resolving them in Godot 3D?

I'm trying to create a script for a platformer player controller in Godot that doesn't use the built in collision system - to challenge myself. Everything was going well, until it came to implementing floor collisions. I successfully created a system for resolving those collisions, but that system doesn't matter if I can't detect when a collision is happening. I tried, but couldn't. Nothing I looked up gave the answers I was looking for. I even asked ChatGPT for help, genuinely expecting a real answer to my problem, but ChatGPT once again proved it's programming incompetence by only recommending me to use things that don't exist in Godot, or to do things that don't solve my problem. Here is a very small snippet of my current code. (I'm using a CharacterBody3D node.)

func _process(delta):
  #fall
  yvel = yvel - gravity
  ypos = ypos + yvel
  setpos(xpos, ypos, zpos)
  if Input.is_key_pressed(KEY_T): #Test. I will replace this with actual collision detection code.
    resolve_collision_forcefully()

Upvotes: 0

Views: 197

Answers (1)

user22692191
user22692191

Reputation: 1

Just use area hitboxes to determine the size of objects and whether they interact.

Upvotes: 0

Related Questions