Two types of flowers. Bees can either land with their backs facing the camera and walk anywhere within an Area2D or they can land with their side facing the camera and walk along a Path2D.
Right now, the lavender bloom’s Area2D first tracks when a bee enters. Then, it checks for landing conditions (a small amount of time after reaching a crest).
The Path2D version won’t have an Area2D. I think what I want to do is check for the landing conditions first, then figure out what to land on (if anything). As usual, I need to remind myself not to worry about performance right now. Tracking a couple variables related to the velocity shouldn’t be a problem.
Also right now, the Area2D flowers… they don’t actually use an Area2D to constrain the movement, they manually clamp the bee’s position to a circle. So maybe that change needs to happen first.
It’s actually hard in Godot to test whether a point is within a shape. I can easily get collision information but not this.
Easier to see if the Area2D’s shape is a circle and if so, do the little bit of geometry myself.
Maybe one day I’ll use PhysicsDirectSpaceState2D but not today:
var space: PhysicsDirectSpaceState2D = get_world_2d().direct_space_state
var params: PhysicsPointQueryParameters2D = PhysicsPointQueryParameters2D.new()
params.collide_with_areas = true
params.collide_with_bodies = false
params.position = global_position
var result: Array[Dictionary] = space.intersect_point(params)
if result.size() > 0:
print(result)