Jump to content

Developing an FPS Camera


Sonic_Serpentine
 Share

Recommended Posts

Hey guys, first post, started using Babylon Friday, so I may be a little green. I'm done waiting for Unity3D's webgl porting to not be a steaming pile.

Really liking everything so far, but I could use some advice on moving forward with an FPS camera.

I extended it from the BABYLON.FreeCamera. Nailed down most of it, but realized that the built-in collision the camera uses has no real concept of friction.

It's going to be a bit of a problem when I intended on having moving floor platforms. They just slide right out from under you as-is.

I'd rather not start from scratch or fall back on TargetCamera because of all the input groundwork that FreeCamera provides.

My best guess for moving forward is to dig in and start overriding the collision functions of FreeCamera like _collideWithWorld(), _updatePosition(), etc. and replace them with Oimo compatible logic.

I just want to get the problem out there before I go down that rabbit hole.

Is this a horrible idea?

Or maybe I'm just missing something incredibly obvious about the built-in physics?

Thanks in advance for any advice.

Link to comment
Share on other sites

I'm a complete noob, so please let me know if I am missing something.

Could you create a mesh like a box and have the physics that you wanted applied to the camera applied to the box instead, then have the box be the camera's parent, I think this is the work around that I see suggested when people are having issues with the camera not behaving as one might expect.

Link to comment
Share on other sites

Well thank you, that helped me troubleshoot things initially.

It turns out adapting the player rig collision to a physics plugin wasn't the way to go. It more or less did what I wanted in terms of sticking to platforms, but raised all sorts of problems with basic motion. 

Manually applying the platform's velocity to the player rig while being stood upon or leapt from turned out to be much simpler.

And now I'm off to write jump pads!

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...