Interacting with 3D objects

Hey, I’m currently trying to figure out how to interact with my 3D models.
I have previously tried using the ‘clicking on 3D objects’ page in the manual and it was all working although my fps dropped to 0.2 which makes my game hardly playable. I’m fairly new to coding so please bare with me but is there a far easier way to interact with objects? I literally just need it to recognise that there has been a collision, know what it’s colliding into and output a specific response.

The “Clicking on 3D Objects” page has a ray colliding with visible geometry, if I recall correctly–and visible geometry is, I’m afraid, not well-suited to collision-testing.

I daresay that you’re likely to see better performance if you do more or less the same as described on that page, but assign collision-objects to your game-objects and have your ray collide with the former.

It’s not easier to implement, I’m afraid, but I imagine that it’s likely to perform better. (As long as you don’t go overboard with your collision geometry–remember that games generally don’t require exactly-fitted collision, and often work better with simplified approximations, I believe.)

For an illustration of how to implement such a thing–if not exactly “clicking on things”, then something similar, at least–perhaps take a look at my “Beginner’s Tutorial”. Specifically, matters of collision detection start from Lesson 6 and run through to Lesson 9, I believe.

(Although those lessons do assume the context of their predecessors, so I would recommend starting at the beginning.)

1 Like

Thank you, I managed to get it working!

1 Like