FPS-Game | A Multiplayer FPS built with Babylon.js | Game Engine library
kandi X-RAY | FPS-Game Summary
kandi X-RAY | FPS-Game Summary
A Multiplayer FPS built with Babylon.js
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of FPS-Game
FPS-Game Key Features
FPS-Game Examples and Code Snippets
Community Discussions
Trending Discussions on FPS-Game
QUESTION
So I'm making this FPS game where I want to move forward, backward, left and right with keyboard input and look around with the camera like in a real FPS-game like Battlefield. The camera movement in combination with the keyboard input works great, but now my camera can fly around. And I just want to be able to stay on the "ground" and move forward, backward, left and right while looking up or down like in a game like battlefield without flying around (like no-clip does). Now If I look down or up and press forward on my keyboard I can "fly", but I don't want this to happen.
A friend of my suggested to use something like this to go forward.
...ANSWER
Answered 2022-Apr-01 at 14:27To make the camera stay on the ground, simply don't move it up and down.
Yeah, the part where the camera moves up and down? You're the one who wrote that code. Delete it.
You didn't say where this Front
vector comes from. It comes from a place that is taking pitch and yaw into account. Delete the pitch part.
Your friend's suggestion glm::vec3(glm::cos(Yaw), glm::sin(Yaw), 0)
is a way to calculate Front
using only yaw.
As your game gets more advanced you may also implement jumping and gravity, so the player can go up and down to a limited extent.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install FPS-Game
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page