Stride Forums Archive

Pick a mesh with Ray

2 posts, 1243 views, 2019-08-26 to 2019-08-30

Subrahmanya_Chakrava (O.S.Chakravarthi) 2019-08-26 #1

Hi,
My game is a code-only game. The complete root scene is created on the fly with code. The scene has models and the models have multiple meshes.

Now I need to implement a feature: When the user clicks on screen, I should be able to get the references of the mesh and model at the clicked coordinates.

I have gone thru the phisycs/raycasting sample but I could not understand. It is using a script component and there is a field “simulator”. Not sure how this field is set.

Can you please help me achieve this in code-onlg fashion?

Thanks in advance.

doomy 2019-08-30 #2

Hey, I just recently was wondering the same! You can get the needed simulation variable by using this.GetSimulation(). Take a look at the TopDownRPG sample provided too, as it does this as well.