Jump to content

player height


cassius
 Share

Recommended Posts

There is a problem here with player height. It is too low. I tried using a cylinder but then the player would not move at all.Also it slows down too slowly acting more like a vehicle than a human.Any help?????

 

 

 

 

 

 

 

 

 

#include "engine.h"

int main(int argc, char** argv)

{

Initialize();

RegisterAbstractPath("C:/mygame");

Graphics(1100,800);

AFilter() ;

TFilter() ;

TFramework framework=CreateFramework();

TLayer layer = GetFrameworkLayer(0);

TCamera cam=GetLayerCamera(layer);

PositionEntity(cam,Vec3(0,0,0));

//Set Lua variable

BP L=GetLuaState();

lua_pushobject(L,framework);

lua_setglobal(L,"fw");

lua_pop(L,1);

// Setup Initial Post Processing FX

//SetGodRays(1);

SetHDR(0);

SetSSAO(0);

SetBloom(1);

SetAntialias(0);

SetStats(1);

LoadScene("abstract::game03map.sbx");

SetSkybox(LoadMaterial("abstract::NiceSky.mat"));

SetBackgroundColor(Vec4(1 ,1, 1, 1));

DebugPhysics(true);

// Setup player

TBody player=CreateBodySphere();

SetBodyMass(player,60);

SetBodyGravityMode(player,1);

SetBodyDamping(player,0);

EntityType(player,1);

SetBodyBuoyancyMode(player,1);

PositionEntity(player,Vec3(-3.18,1.07,-40.67));

Collisions(1,1,1);

TVec3 camrotation=Vec3(0);

float mx=0;

float my=0;

float move=0;

float strafe=0;

HideMouse();

MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

// MAIN LOOP

while (!KeyHit(KEY_ESCAPE))

{

//UpdateAppTime() ;

UpdateWorld(AppSpeed()) ;

mx=Curve(MouseX()-GraphicsWidth()/2,mx,6);

my=Curve(MouseY()-GraphicsHeight()/2,my,6);

MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

camrotation.X=camrotation.X+my/10.0;

camrotation.Y=camrotation.Y-mx/10.0;

RotateEntity(cam,camrotation);

 

move=KeyDown(KEY_W)-KeyDown(KEY_S);

strafe=KeyDown(KEY_D)-KeyDown(KEY_A);

TVec3 force = Vec3(strafe*10.0,0,move*30.0);

force=TFormVector(force,cam,0);

AddBodyForce(player,force);

PositionEntity(cam,EntityPosition(player));

 

// Update timing and world

UpdateFramework();

// Render

RenderFramework();

// Send to screen

Flip(0) ;

}

return Terminate();

}

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

for most inherent meshes and bodies in LE, the position is the center... so if you are setting the camera at the position of the "player" then it will be at the center of the "player"... we use to have a similar issue back when the controller position was at the center instead of at the foot of the cylinder... just offset the Y value of the results of the EntityPosition(player) before setting the position of the camera just like you do with a controller...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks mac.

 

I get an error on the line

 

PositionEntity (player,vec3(0,1.8,0));

 

The error reads Tvec3 not declared in this scope.

 

Can someone show me how it should be done.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

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...