Ok, here is a basic First Person control set up that I built over the past few days,. I am going to develop a game using this; however, in an attempt to help grow the ZGE community I am offering this as our first community based game engine!
My hope is that the rest of you will have a look at what I have done here and help make improvements, and add more to it, so we can all benefit from working together on a simple first person game framework.
I am just using the Box3D collision style,. I attempted to do this with the OBB style,. however, as the player or targets rotated they would get stuck in the "walls". Using this method we also gain jumping support with out having to code much for the z direction as the Box3D does most of the work. The jumping is one feature that is still not wroking correctly just yet,. my 'grounded' variable is not being reset properly,. and the player can sometimes jump in the air,.
The other major issue currently is the translateing of the aiming into the proper velocity for the z axis of the shots,. currently it works somewhat however it is just a crude hack I guessed at,. and the aim is a bit off. As you know my math skills are weak,. but what i can see is that as the angle moves away from the horison the x and y velocity needs so decrease,. just not sure the proper relationship for that,. trig once again.
So there you go,. have a look and post improvements or additions or just chat about possible implementations of such an engine. peace.
basic First Person engine - an open-source community project
Moderator: Moderators
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
basic First Person engine - an open-source community project
- Attachments
-
- basic_FP_engine_001.zip
- iteration 001 of the open source ZGE FP engine!
- (3.23 KiB) Downloaded 676 times
iterationGAMES.com
Hi,
Use the following code to get the aim right.
What's horizontal, vertical etc. depends on your preference. I've attached a example, aim with mouse and shoot with left mouse button.
K
Use the following code to get the aim right.
Code: Select all
CurrentModel.Velocity.Vertical = sin(CurrentModel.Rotation.Vertical*Pi*2);
CurrentModel.Velocity.Longitude = sin(CurrentModel.Rotation.Horizontal*Pi*2)*cos(CurrentModel.Rotation.Vertical*Pi*2);
CurrentModel.Velocity.Lattitude = cos(CurrentModel.Rotation.Horizontal*Pi*2)*cos(CurrentModel.Rotation.Vertical*Pi*2);
K
- Attachments
-
- Aim.zip
- (38.33 KiB) Downloaded 674 times