Jump to content

DarthRaff

Members
  • Posts

    152
  • Joined

  • Last visited

Everything posted by DarthRaff

  1. hey, i just changed acceleration, sorry, now works perfect. Thankyou very much Marleys Ghost, but why multiply move and strafe per 3?
  2. Yes is the same of the character controller. And here is monsterfuncs.h: void SlowPointEnt(TEntity ent1,TEntity ent2,float speed) { TVec3 ent1pos=EntityPosition(ent1); TVec3 ent1rot=EntityRotation(ent1,0); TVec3 ent2pos=EntityPosition(ent2); float dx=0.0; float dy=0.0; float dz=0.0; float rz=0.0; //float speed=1.0; dx=ent1pos.X-ent2pos.X; dy=ent1pos.Y-ent2pos.Y; dz=ent1pos.Z-ent2pos.Z; rz=ent1rot.Z; return AlignToVector(ent1,Vec3(dx,rz,dz),3,speed); } void AnimeEntitySeq(TEntity ent,float startframe=0.0f, float finalframe=1.0f, float vel=1.0f, float partitiontime=100.0f) { float frame; //framebegin=startframe; //frameend=finalframe; //Animate(ent,frame,1,0,1); frame=(AppTime()*vel)/partitiontime; //frame=fmodf(frame,frameend-framebegin)+framebegin; frame=fmodf(frame,finalframe-startframe)+startframe; Animate(ent,frame,1,0,1); }
  3. You right, sorry, but when i try to attach something have that error: "Error You aren't permitted to upload this kind of file". please tell me how to attach files. change to 500 or 100 don't solve the problem, thankyou.
  4. hi, The problem is that if i put a cube with collision created by code or two or three, the collisions goes perfect, but if i try to put more than one oildrums or another gmf file the collisions fails because if you collide with an object it goes away too fast or keeps rotating around the character controller, or another malfunction. If there is just one oildrum or just one monster created by me the collisions goes perfect but if i try to put two or more of the gmf objects in the same scene the collisions fails i don't know way. all updated and copied to the right place because the collisions of objects created by code works perfect just fails more than one gmf in the same scene. The code above is for best understanding of the problem. If you coul'd try it you will see. the first fails and then if you delete oildrum2 from the code then goes perfect with one cube create by code and one oildrum.gmf.
  5. Please, I have problems with collisions and don't know how to solve it. Can someone try and tell me, please. Thankyou.
  6. Hello, Can someone, please, copy that code (i assume you have the SDK oildrum model)and do: First execute it and try collide with some object. Then delete oildrum2 from code,execute and try collide with some object. Any difference? please, tell me. THankyou the code: #include "engine.h" #include <math.h> #include <string> #include <vector> #include "monsterfuncs.h" using namespace std; string nametext; #pragma warning(disable:4996) int state; float fb; float fe; TController player; class Monster { public: TController monstercont; TMesh monsterent; TVec3 monsterpos; TVec3 monsterrot; int monsterstate; float mstartframe; float mendframe; }; vector<Monster> monsterarray; vector<Monster>::iterator monsteriter; void UpdateMonsters() { for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++) { SlowPointEnt((*monsteriter).monstercont,player,.5); (*monsteriter).monsterrot=EntityRotation((*monsteriter).monstercont); UpdateController((*monsteriter).monstercont,(*monsteriter).monsterrot.Y,0.0f,0.0f,0.0f,10000); RotateEntity((*monsteriter).monsterent,(*monsteriter).monsterrot); //PositionEntity((*monsteriter).monsterent,EntityPosition((*monsteriter).monstercont)); PositionEntity((*monsteriter).monsterent,Vec3((*monsteriter).monsterpos.X,(*monsteriter).monsterpos.Y-1.5,(*monsteriter).monsterpos.Z)); if(KeyHit(KEY_UP)) { if((*monsteriter).monsterstate <3) { monsteriter->monsterstate++; } else { monsteriter->monsterstate=0; } } if(KeyHit(KEY_DOWN)) { if((*monsteriter).monsterstate >0) { monsteriter->monsterstate--; } else { monsteriter->monsterstate=3; } } switch ((*monsteriter).monsterstate) { case 1: monsteriter->mstartframe=41.0f; monsteriter->mendframe=85.0f; break; case 2: monsteriter->mstartframe=90.0f; monsteriter->mendframe=117.0f; break; case 3: monsteriter->mstartframe=149.0f; monsteriter->mendframe=184.0f; break; default: monsteriter->mstartframe=1.0f; monsteriter->mendframe=40.0f; break; } AnimeEntitySeq((*monsteriter).monsterent,(*monsteriter).mstartframe,(*monsteriter).mendframe,3.0f,100.0f); } } int main( int argn, char* argv[] ) { int screenx=1024, screeny=768, camx=screenx/2, camy=screeny/2; Initialize() ; //RegisterAbstractPath("C:/Archivos de programa/Leadwerks Engine SDK 2 28"); //Create a graphics context Graphics(screenx,screeny); //Create a world if (!CreateWorld()) { MessageBoxA(0,"Error","Failed to create world.",0); goto exitapp; } //Create a camera TCamera cam=CreateCamera(); CameraClearColor(cam,Vec4(0,0,1,1)); PositionEntity(cam,Vec3(0,2,-10)); Collisions(1,1,1); Collisions(1,2,1); Collisions(2,2,1); //Load a model TModel scene=LoadModel("scene/scene.gmf"); if (scene==0) { MessageBoxA(0,"Error","Failed to load model.",0); goto exitapp; } EntityType(scene,2); //Create lightent TMesh lightent=CreateSphere(); ScaleEntity(lightent,Vec3(.5,.5,.5)); PositionEntity(lightent,Vec3(0,5,0)); //Create a light TLight light=CreatePointLight(); PositionEntity(light,Vec3(3,5,-3)); EntityColor(light,Vec4(2,2,2,1)); SetShadowmapSize(light,1024); AmbientLight(Vec3(0.2)); EntityParent(light,lightent); //Create a render buffer TBuffer buffer=CreateBuffer(screenx,screeny,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); //Monster m; //m.monstercont=CreateController(2.7f,0.9f,0.25f,45); //m.monsterent=LoadMesh("objs/monsters/DK1/dk1.gmf"); //m.monsterrot=Vec3(0.0f,0.0f,0.0f); //m.monsterpos=Vec3(0.0f,1.5f,0.0f); //m.monsterstate=0; //RotateEntity(m.monstercont,m.monsterrot); //RotateEntity(m.monsterent,m.monsterrot); //PositionEntity(m.monstercont,m.monsterpos); //PositionEntity(m.monsterent,m.monsterpos); //EntityType(m.monstercont,2); //SetBodyMass(m.monstercont,1.0f); //monsterarray.push_back(m); int sequence=1; float framebegin; float frameend; float frame; //Create a physics body TBody body=CreateBodyBox(); SetBodyMass(body,1.0f); TMesh mesh=CreateCube(); EntityParent(mesh,body); PositionEntity(body,Vec3(-3,5,0)); EntityType(body,2); //Create another physics body TModel oildrum=LoadModel("scene/oildrum.gmf"); PositionEntity(oildrum,Vec3(3,5,0)); EntityType(oildrum,2); SetBodyMass(oildrum,1.0f); TModel oildrum2=LoadModel("scene/oildrum.gmf"); PositionEntity(oildrum2,Vec3(0,5,0)); EntityType(oildrum2,2); SetBodyMass(oildrum2,1.0f); player=CreateController(1.84f,0.50f,0.25f,45); EntityType(player,1); //SetBodyDamping(player,.5f,.5f); SetBodyMass(player,1.0f); //SetWorldGravity(Vec3(0,-9.8f,0)); float move=0.0; float strafe=0.0; TVec3 camrotation=Vec3(0); TVec3 playerpos; float mx=0; float my=0; HideMouse(); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); PositionEntity(player,Vec3(0,0,-3)); SetWorldGravity(Vec3(0,-9.8f,0)); SetPhysicsQuality(1); int debphy=0; //Main loop // Game loop while( !KeyHit() && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { // Update timing and world UpdateAppTime(); UpdateWorld(AppSpeed()) ; //UpdateAppTime(); if(KeyHit(KEY_P)){debphy=1-debphy;DebugPhysics(debphy);} //DebugPhysics(KeyHit(KEY_P)); TurnEntity(lightent,Vec3(0,.5f,0)); //Player movement move=2*(KeyDown(KEY_W)-KeyDown(KEY_S)); strafe=2*(KeyDown(KEY_D)-KeyDown(KEY_A)); //Jumping float jump=0.0; if (KeyHit(KEY_SPACE)) { if (!ControllerAirborne(player)) { jump=4.0; } } //Run if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) { if (!ControllerAirborne(player)) { move*=2.0; strafe*=2.0; } } playerpos=EntityPosition(player); //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/5.0; if (camrotation.X < -90){ camrotation.X = -90;} if (camrotation.X > 90){ camrotation.X = 90;} camrotation.Y=camrotation.Y-mx/5.0; RotateEntity(cam,camrotation); ////Set controller input PositionEntity(cam,Vec3(playerpos.X,playerpos.Y+.84,playerpos.Z)); TVec3 camerapos=EntityPosition(cam); TVec3 poscont=EntityPosition(player); PositionEntity(cam,camerapos); //UpdateController(player,camrotation.Y,move,strafe,jump,15000.0); UpdateController(player,camrotation.Y,move,strafe,jump,10000); //Render the scene //UpdateAppTime(); //UpdateWorld(); if(KeyHit(KEY_NUM8)) { if(state < 3) { state++; } else { state=0; } } if(KeyHit(KEY_NUM2)) { if(state > 0) { state--; } else { state=3; } } switch(state) { case 1: fb=41.0; fe=85.0; break; case 2: fb=90.0; fe=116.0; break; case 3: fb=149.0; fe=184.0; break; default: fb=0; fe=40; break; } UpdateMonsters(); // Render SetBuffer(buffer); RenderWorld(); SetBuffer(BackBuffer()); RenderLights(buffer); DrawText(10,10,"%.3f",UPS()); DrawText(10,30,"%d",TrisRendered()); // Send to screen Flip(0) ; } } // Done exitapp: return Terminate() ; }
  7. sorry, so that is not working now ?: dofile("scripts/base.lua") function InitDialog(grid) base_InitDialog(grid) group=grid:AddGroup( "tree Properties" ) group:AddProperty( "Classname", PROPERTY_STRING,'') group:AddProperty( "tipo", PROPERTY_STRING,'' ) group:Expand(1) end
  8. Hi, I have a map with some objects that have properties made by me in lua that worked with 2.30 first version. When i update recently from 2.30 that properties are no longer available. am i missing something? thanks
  9. Thank you very much but newton.dll is copied and i tried with a mass of 0.1. They don't go away when collide but the character controller still have a bad behavior when touch an object. The object makes the character contoller step over it. I have also a monster with a character controller and collision set to 1 like the character controller of the player and collision 1,1 activated but there is no collision between the two character controllers, sorry but i can't find the problem
  10. I updated from 2.30. Before the update the 2.30 version works perfect. After the last update the physics fails with the same code. The code is the charactercontroller tutorial with the appropriate changes. With "first" 2.30 works and now not. the most not understandable for me is the bodies created by code not working, because i can understand that after an update we have to change phy files, but if it is created by code....Thankyou.
  11. Hello, I updated leadwerks 2.30 to new update and physics seems to fail. When the player touches an object it starts to fly up or go away too fast. Have i to change any phy file or something, because it happens even with the Bodies creates by code too. Tankyou.
  12. I already tried those things, but thankyou very much Wailingmonkey, very appreciated the topology link, thankyou
  13. Hello, I looked in google for a long time for tutorials and tried using milkshape 3d 1.84 that allows vertex weights and i tried also 3dsmax and character studio but i can't find how to assign vertex correctly to the shoulders or how to make the shoulders deforms properly, so, can someone put me an example of how to process the shoulders properly, please ? thankyou
  14. Hello, I don't know if you having the same problem i experienced but i solved it thanks to the comunity like that way: Look in the editor in the directionallight "creator". make double click and it will open the lua script. then you have to look for that: function InitDialog(grid) base_InitDialog(grid) group=grid:AddGroup("Light") group:AddProperty("Resolution",PROPERTY_CHOICE,"256,512,1024,2048") group:AddProperty("linearoffset",PROPERTY_VEC3,"","Linear offset" ) group:AddProperty("shadowdistance",PROPERTY_VEC3,"","Shadow distance" ) //The above line have to be PROPERTY_VEC3 like you see here because it is PROPERTY_INT //or something different to VEC3 group:AddProperty("Range",PROPERTY_FLOAT) group:Expand(1) end Hope it help you and sorry if it is a litle confusing
  15. Thankyou very much Marleys Ghost, solved
  16. Hello, I'm trying my own terrain texture. I put the texture in Materials/Terrain/Myown folder but when i open the paint dialog and select an empty one, my folder doesn't appear in the box with forest, mountain, desert, etc... and neither my textures of course. What i'm doing wrong? thankyou. I can't post the textures because it say me " Error You aren't permitted to upload this kind of file" but they are in DDS format with mipmaps etc, sorry.
  17. Hello everybody, trying the new place. I like it and hope it will be at least as good as the other. Thankyou all for keeping it up.
×
×
  • Create New...