Trying to get a mouse position in 3d by getting where it is on an arraymesh (i.e. the terrain in this case)
however. raycasting returns exactly nothing when pointing at the mesh, am guessing i'm missing something important (or trying to do something the hard way, any and all advice wanted)
(this: https://www.reddit.com/r/godot/comments/s884q0/tycoonstyle_terrain_proof_of_concept/ is roughly my end result, i have the ability to move terrain at will...but doing so with the mouse is proving beyong my coding and googling skill)
#Raycasting to an ArrayMesh
1 messages · Page 1 of 1 (latest)
The raycast will only hit PhysicsBodies with colliders attached, so if your body doesn't have any collision it won't report anything
that matches with some of the stuff i wasnt quite getting, is there a nice way to give said arraymesh a collider? what i saw when googling anything to do with collison only turned up very basic options
You should be able to use the array_mesh.create_trimesh_shape() method, which you can attach to a CollisionShape3D node as a child of a StaticBody3D that is a child of the MeshInstance, so the whole tree would look like this:```
Terrain (MeshInstance3D)
- StaticBody3D
- CollisionShape3D, shape=array_mesh.create_trimesh_shape() (set in the script)