Jump to content
Undeceived

Check if player looks inside a 3D trigger

Recommended Posts

Hello guys.

 

The problem: I have an addAction on an object ("Take object"), which appears when the player looks at it (means when the center of the screen is on the object - I think it's the same as cursorObject or cursorTarget).

This normally works fine but I noticed that in some cases it doesn't. The action appears when the player looks somewhere under or beside the object (I'm using a leaflet) but not when he looks right AT it. I think this is related to the fact that the leaflet is placed on the ground of a shed which I placed in the editor. On the ground itself (outside) it works ok.

 

Because of this problem I fear that the player would look at the object but go on because the action doesn't appear. ThereforeI want to expand the area on which the player can look to activate the action. And what else could be better than a 3D trigger. :icon_biggrin:

 

Now, is there a way to check if the player is looking into the dimensions of this trigger cube?

 

y4mujw4cg7qXySldZmmGwZGuaxFzomcma0oyaELf

 

Any input (other ideas too) is appreciated, thanks.

Share this post


Link to post
Share on other sites

This might be a stupid opinion and never tested though, if addAction on the leaflet doesn't work as well, how about using Geometry Sphere?

Place the Sphere at the same exact position and apply addAction in its initialization? IIRC this is the way to create retrieve memory event in Remnants of War.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Great idea, @POLPOX. I used the 25 cm sphere, set its texture to #(argb,8,8,3)color(0.898039,0.403922,0.133333,0.000000,ca) (invisible), changed the code for the addAction and it works great now. :icon14: 

 

The only disadvantage is that when looking at it, there appears the name "Geometry sphere" on the screen, but it's not a big deal.

Thanks a lot!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×