Jump to content

Side Scroller Character Controller


Slastraf
 Share

Recommended Posts

I want to go 3D with my 2D Side scroller character controller.

As you can see at the bottom I want to program a tourning controlIer.

It is pretty much easy to explain but for me hard to think of how to approach this.

I dont want to use hundreds of pivots for each angle thats for sure:)

 

But what would be any good way to make this ?

 

post-12189-0-63792300-1457624166_thumb.png

post-12189-0-15983500-1457624190_thumb.png

post-12189-0-68167200-1457624200_thumb.png

source:

Link to comment
Share on other sites

From watching that video, it's almost like there are 2 pivots. One at the start of where you want to rotate and one at the end and the amount of rotation that happens depends on the distance you are to that pivot.

 

So maybe a way to do this would be to put a csg with invisible mat on it and set to trigger with a script attach around this entire area. Then put 2 pivots on the start and end of this area. When the player is inside the trigger and moving in the "right" direction check the distance from the end pivot and rotate a value based on that. If the player is moving "left" check the distance from the start pivot and rotate a value based on that.

 

How to figure out how much to rotate by distance, I'm not 100% sure. I guess you'd figure out how much total rotation you want first. Then you'd figure out the total distance from the 2 pivots. That should tell you perhaps how much to rotate every 1 cm based on the distance each frame. Then use the Math:Curve function to make it smooth.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...