DarthRaff Posted January 22, 2013 Share Posted January 22, 2013 Hello, Can someone, please, tell me what am i doing wrong ? i'm trying to translate it from lua with no success, thank you very much. if (KeyHit(KEY_E)) { TPick pick; pick = CameraPick(&pick,cam,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,3.0),0,0); if (pick) { do { if (GetEntityKey(pick.entity,"class") == ENTITY_MODEL) { break; } pick.entity = pick.entity.parent; } while (!pick.entity); if (pick.entity) { SendEntityMessage(pick.entity,"use"); } } } Quote Link to comment Share on other sites More sharing options...
macklebee Posted January 22, 2013 Share Posted January 22, 2013 http://www.leadwerks.com/werkspace/topic/3226-camerapick-with-bodies/#entry29657 Quote 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 More sharing options...
DarthRaff Posted January 22, 2013 Author Share Posted January 22, 2013 Thank you very much, i'll try Quote Link to comment Share on other sites More sharing options...
DarthRaff Posted January 22, 2013 Author Share Posted January 22, 2013 So sorry, very long time no programming. I don't know how to use the two functions to have it working. GetMeshModel() is used by GetPickedEntity() but how to use it, i'm very lost. I tryied this but, of course, it's wrong if (KeyHit(KEY_E)) { TPick pick; pick = CameraPick(&pick,cam,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,3.0),2,0,0); SendEntityMessage(GetPickedEntity(pick,3.0f,0),"use"); } Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted January 22, 2013 Share Posted January 22, 2013 You would need to include the function definition as shown below: TModel GetMeshModel(TEntity _Entity) { string strClassname; while (_Entity != NULL) { strClassname = GetEntityKey(_Entity, "class"); if (strClassname == "Model") { return _Entity; } _Entity = GetParent(_Entity); } return NULL; }; and then modify your code so that the entity you are looking to pass the message to is obtained from: GetMeshModel(pick.entity) Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
DarthRaff Posted January 22, 2013 Author Share Posted January 22, 2013 Ok, working now. Thank you very much everybody for your time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.