playMaker

Author Topic: First person controller  (Read 134 times)

Dmonty

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
First person controller
« on: January 09, 2020, 08:11:56 PM »
Hi everyone,

I'm trying to research how to create a first person controller that can interact with objects using raycast. For example. When object (crate) is within distance and the player is looking at it, they can open it by clicking on it. I know that this would be some sort of mouse event, but how cant I setup the first person controller to do this. Here is an example of what I'm trying to do

Thank you,


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14832
  • Official Playmaker Support
    • View Profile
Re: First person controller
« Reply #1 on: January 14, 2020, 12:51:30 AM »
Hi,

where are you stuck at the moment?

- do you have a character controller to move around your scene like in this video?
- do you have a raycasting firing in the forward direction of the character?
- are you able to detect what's being hit by the raycast?
- are you able to check the distance of the hit?

if all that is true, you can then have an fsm that react in mouse down and check what's currently being hit, its distance and then decide what is the action to perform.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14832
  • Official Playmaker Support
    • View Profile
Re: First person controller
« Reply #2 on: January 14, 2020, 01:18:17 AM »
Hi,

 downloaded the project and it's actually not that complex as it locks the mouse position in the center,

you can use MousePick action for example, you can also use your own raycast should you want to filter by tags ( mousepick only filters by layer)



let me know how it goes for you.

Bye,

 Jean

Dmonty

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: First person controller
« Reply #3 on: January 21, 2020, 12:09:23 PM »
Sorry for the delayed response! Thank you so much for this:) I'm going to create a character controller and try an set up everything the way suggested and will get back to you. Again, I'm really sorry for the delayed response.

-David