Third Person Controller for plyGame


(Leslie Young) #1

Here’s a different controller for plyGame. It has not been intensively tested and it was not created for plyGame specifically (only adapted to work with it) so there might be things that do not work right. Let me know if you find something strange and I might fix it. You can also use it outside of plyGame but will have to change some plyGame specific calls like the input stuff.

Download Link

If you use the player manger to spawn the player, which you probably will be, then make sure to place the CameraRig prefab in all scenes the player will be spawned in.


Edit Third Person Camera PlyGame (for Photon)
3rd Person Camera Rotation Help!
Time for jump
What triggers "onGround" to turn false?
(Cameron Scarlett) #3

This is fantastic. How could I edit this to allow for walking backwards?


#4

Just use the standard third person controller that comes with plyGame.

Youll notice in the plygame editor there is a tab for Input Definitions and there in the controller settings you can edit those keybinds.


(Cameron Scarlett) #5

Hey, thanks for the response. The inputs are properly set. Maybe it’s something else within my setup, but while using this camera, pressing ‘S’ causes the player to rotate around to face and run toward the camera.

What I’d like to implement instead is a backwards walk/strafe that doesn’t affect the character’s rotation.


#6

Make sure to use the standard 3PC not the one here if you want that functionality.


(Leslie Young) #7

This specific controller was created to work the way it works with the character running towards camera when you press back key.

You can use the plyGame > Character > Player > Third Person Controller for something that can move backward and strafe.


#8

Awesome, thank you for sharing this.
In case of spawning player, it won’t work, so I did those simple modifications.

In Start I commented out enabled=false

if (target == null)
            {
                //enabled = false;

In the DoUpdate() I added those lines at the beginning

if (target == null) { Start(); return; }

Thank you always for the awesome stuff.


(Leslie Young) #9

ah, good catch. I’ve fixed the problem so grab the new one.
You will have to at least have the CameraRig in the scene(s).
.


(Иван Фатин) #10

Fantastiq! and nicely gamepad controller. So Greatebly!
And great work addForce and other physic on character!


(Jason Burch) #11

Just got this working with UMA 2 thanks :slight_smile: great controller.


#12

The controller is great and working so well, but I noticed two problems.

The first is that if the game is paused while the player is running (pressing forward key), the player continues to run while the game is paused even if the forward button is released.

The second problem is that when ‘Auto Move To Interact’ is checked, the player does not move to the object, but if I moved using controls to the right distance, the interaction occurs.

Thanks for advance.


(Marshall Heffernan) #13

Use a “Request Stop” block on your player, right above your “Pause” block. :wink:


#14

Thank you always for your prompt reply. But I am sorry I cannot find ‘Request Stop’ block, can you tell me the category?
I found the stop movement block, but the bug is still there.

I call this event from code when the menu appears and the debug ‘pause’ is output, so the blocks is called.

Thank you for your great support.


#15

Do I need a nav mesh agent for the player for the ‘Auto Move To Interact’ to work?
I am using a nav mesh agent for the enemies and it works great, but when I put a nav mesh agent on the player, it goes crazy moving around insanely from the time it is spawned, even if I did not do anything.


#16

OK, I noticed that I had a nav mesh obstacle on the player, so I removed it and now the crazy running is gone. But the player still do not move to object to interact with it.
Also if the nav mesh agent base is slightly above or under the bottom of the capsule collider, the player’s jump like animation start flickering.


(Johnathan Mack) #17

I tried using this controller, but for some reason with any model i update when I start the scene, they launch into space


(Leslie Young) #18

Check your colliders. Make sure your are using sane values in the inspector of the controller. Have not experienced that behaviour myself yet.


#19

I like this a lot but can’t get my player to stop moving. He moves in all directions very nicely–using wasd keys–but he doesn’t stop moving. I really like the camera controls but need to fix little issue about stopping movement.


#20

I fixed this. It turns out I had the Basic Mechanim Controller on the Player. Removing that, he now moves and stops perfectly. Thanks, Leslie, for this. : )


#21

I added my animator on the player, the animator works fine but the player doesn’t move. Anyone know how to solve it?