Jump to content

DWORD

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by DWORD

  1. DWORD

    Onclick event

    But like ZioRed said you need to identify your mesh/model with GetEntityKey()(or myent.GetKey() in LEO) or your entire scene will be selectable, in other words if you have 2 diferent models in the same scene they will be the same (like a Wall and a Soldier). You can set the EntityKey youself if you want.
  2. DWORD

    Onclick event

    Controller isn't a input manager, a controller is an Entity. You doesn't need to create a mouse in C/engine.h just use the mouse functions. The mouse that the engine uses is the Windows default mouse, but if you want a custom icon you can draw a image at the same position as the mouse and hide the windows mouse(HideMouse() using engine.h). Sorry about my english.
  3. DWORD

    Onclick event

    You can do something like this: Mouse mymouse; Camera mycam; Pick mypick; Entity myent; mycam.Create(); if(mymouse.IsDown()) { if(mycam.GetPick(mypick,Vec3(mymouse.GetX(),mymouse.GetY(),1000))) { //Do something when the mesh GetPicked myent = mypick.entity; myent.SetColor(Vec4(1,0,0,0)); } }
  4. Whenever i try to download the SDK it stops at 115mb and get corrupted.
  5. Thanks, it worked.
  6. Hello. I want to attach a model (sword) to a bone (hand) and make the sword follow the hand with precision(position,rotation). How can i do this?
  7. Really thanks, i didn't knew about this Pivot
  8. Hello. I'm new with LW engine(and here). I'm just messing around with the engine to learn. I just built a top-down (simple) game with a player that look at the cursor but isn't accurate for isometric views( is perfectly good in 2.5d shooters and top-down view). Engine engine; Mouse m; float res = 0; int xw = 0, yh = 0, result = 0; //X if(m.GetX() > engine.GetWidth()/2) { xw = -((engine.GetWidth()/2)-m.GetX()); } else { if(m.GetX() < engine.GetWidth()/2) { xw = -((engine.GetWidth()/2)-m.GetX()); } else { xw = 0; } } //Y if(m.GetY() > engine.GetHeight()/2) { yh = ((engine.GetHeight()/2)-m.GetY()); } else { if(m.GetY() < engine.GetHeight()/2) { yh = ((engine.GetHeight()/2)-m.GetY()); } else { yh = 0; } } //Set the angle if(yh > 0 && xw == 0) { result = 90; } else if(yh < 0 && xw == 0) { result = 270; } else if(xw > 0 && yh == 0) { result = 0; } else if(xw < 0 && yh == 0) { result = 180; } else if(xw == 0 || yh == 0) { result = 0; } else { res = (float)yh/xw; result = (atan(res) * 45) / 0.785398163; } //Correct the angle if(result < 0) { result = -result; } if(xw < 0 && yh > 0) { result = (90-result)+90; } else if(xw < 0 && yh < 0) { result = 180+result; } else if(xw > 0 && yh < 0) { result = (90-result)+270; } As you see is really messy(the rest of the code is worse ). To use this you have to set rotation of your entity(Y axis) to "result" like this "YourEntity.SetRotation(Vec3(0,result,0));". So have another way to do this? Thanks. Sorry about my english.
×
×
  • Create New...