Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ScrumpyFly on March 21, 2019, 03:09:21 PM

Title: Fixed Camera Character Alignment Issue
Post by: ScrumpyFly on March 21, 2019, 03:09:21 PM
I'm currently testing out a fixed camera angle game akin to the PS1 Resident Evil games. However, instead of tank controls I want to use full 360 degrees movement like REmake HD.
I have my character movement set up with a Vector3 relative to the Main Camera and a simple move. The camera moves to predetermined spots once the player triggers them.
Now this all works great except for when the camera changes position, the Vector3 movement is based on the new position and the character will change direction, sometimes making me move backwards to the previous camera. Now I understand why this is happening but is there anything I can do to have the characters previous direction continue into the new camera position until I release the key?

Thanks for any help you can provide  :)
Title: Re: Fixed Camera Character Alignment Issue
Post by: Athin on March 21, 2019, 07:30:43 PM
Hey there

What I'd try is getting the position of the camera in a variable.  Once you have it,  you can use that as your reference.  whenever the player stops, have it update its position to the camera again.  That way once you start moving, that variable will stay the same while the camera whips around and not effect movement until the player stops.

thanks
Title: Re: Fixed Camera Character Alignment Issue
Post by: ScrumpyFly on March 25, 2019, 11:56:29 AM
Thanks for the advice, I think that's a great solution.

I've been working on making this happen for a couple days now but I for the life of me cannot get it to work how I want.

Is there a way to reset a Vector3's value? Or perhaps log the previous position?

Since the Camera's position variable is drawing its value from the Players vector3 I'm having trouble separating the 2 values

Thanks for any further help you can offer
Title: Re: Fixed Camera Character Alignment Issue
Post by: Athin on March 25, 2019, 06:14:34 PM
Hey there,

How exactly is your camera working?  I'm a bit confused why its base off of player position?

What I'd do if I was you is make an Array for each camera position.  Once you have all your preset locations plug into the array,  all you have to do is get the index and set the camera V3 to that index. 

If you got a ton of positions,  you can even make multiple arrays to help organize it better so you don't confuse yourself later (EX Array Name House hall way, Outside, Roof ect...) 

Thanks
Title: Re: Fixed Camera Character Alignment Issue
Post by: djaydino on March 26, 2019, 03:36:37 AM
Hi.
Could you show a video of the issue and your fsm setup?
Title: Re: Fixed Camera Character Alignment Issue
Post by: ScrumpyFly on March 27, 2019, 05:06:15 PM
link=topic=20278.msg88898#msg88898 date=1553585797]
Hi.
Could you show a video of the issue and your fsm setup?
[/quote]

Hey there

Here's what you requested, let me know if you need more

https://db.tt/YhfHiz5D7o
https://db.tt/YhfHiz5D7o
[quote author=djaydino

As you can see, I have a Getaxisvector on the character model relative to the main camera. There are invisible triggers that tell the main camera where to reposition once triggered.
Because the vector is relative to the main cam, every time the camera shifts position the players angle of motion is altered.

I'm trying to use an array as previously suggested but I am unable to make the character move relative to the captured coordinates
Title: Re: Fixed Camera Character Alignment Issue
Post by: djaydino on March 27, 2019, 06:01:01 PM
Hi.
You are setting the cameras as main to swap?

on the "relative to" maybe you can set a variable instead (name it "Relative Camera" for example) .
Then have the 1st used camera in it.

Then when camera changed by trigger set the camera to a variable (name it "Current Camera" for example)

Then detect key release and on release set the "Current Camera" variable to the "Relative Camera" variable.

To set a value from another fsm you can use "Set Fsm" actions.
So for the camera you would need to make a object variable, then Set Object type to Unity Engine/Camera.
Then use the "Set Fsm Object"

To get the Camera Component, you can use "Get Component" 1st make a Variable (same as above) then you can set it on the action.

I did not test this btw.

If this does not work i will try to make a sample in the next days.
Title: Re: Fixed Camera Character Alignment Issue
Post by: SeanC on March 30, 2019, 04:34:32 PM
I'm actually looking at solving this exact problem right now myself! I'm going to try to play wit this over the weekend. If anyone else is able to solve this in an elegant way, PLEASE post here so we can all benefit!

Thanks!
Title: Re: Fixed Camera Character Alignment Issue
Post by: SeanC on March 30, 2019, 04:36:50 PM
For what its worth, I don't think you want to update when the player stops. You almost want to update as the player adds in new input. I'm not entirely sure how to do this, or if it is even feasible with PM. Again, I'll give it a go, but perhaps Jean could chime in and give his thoughts??
Title: Re: Fixed Camera Character Alignment Issue
Post by: Athin on March 31, 2019, 07:24:50 PM
Hey there

Have you tried my solution I said at the start?  I believe that should solve the issue described unless there is another problem that pop up/ I don't know about.

Storing the camera's current location and only updating that once the player stops movement will let you use the starting camera position as a reference regardless  where it currently is.

Let me know if that helps.