Gabriel Posted November 16, 2011 Share Posted November 16, 2011 Hello World ;-) What the equivalent function of getClass from LUA in C++ Thank Gabriel Quote Link to comment Share on other sites More sharing options...
TheoLogic Posted November 16, 2011 Share Posted November 16, 2011 There is none. What do you want to do? Quote Follow me Link to comment Share on other sites More sharing options...
Gabriel Posted November 16, 2011 Author Share Posted November 16, 2011 Hello if KeyHit(KEY_E)==1 then pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0) if pick~=nil then repeat if pick.entity:GetClass()==ENTITY_MODEL then break end pick.entity=pick.entity.parent until pick.entity==nil if pick.entity~=nil then pick.entity:SendMessage("use",controller,0) end end end make same of this code in C++, but i cannot find in documentation this function GetClass() in prototype.header Thank Quote Link to comment Share on other sites More sharing options...
Roland Posted November 16, 2011 Share Posted November 16, 2011 int GetEntityType(TEntity entity); Types are ENTITY_MESH ENTITY_EMITTER ENTITY_MODEL ENTITY_BODY ENTITY_TERRAIN ENTITY_BONE ENTITY_CAMERA ENTITY_CORONA ENTITY_SPOTLIGHT ENTITY_LISTENER ENTITY_PIVOT ENTITY_MESHLAYER ENTITY_POINTLIGHT ENTITY_DIRECTIONALLIGHT ENTITY_VEGETATION ENTITY_CONTROLLER ENTITY_ALL ENTITY_RENDERABLE Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Gabriel Posted November 16, 2011 Author Share Posted November 16, 2011 Thanks, Merci ;-) Quote Link to comment Share on other sites More sharing options...
macklebee Posted November 16, 2011 Share Posted November 16, 2011 has this been changed recently? as GetEntityType() previously returned the collision type not the entity class... 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...
Roland Posted November 16, 2011 Share Posted November 16, 2011 has this been changed recently? as GetEntityType() previously returned the collision type not the enity class... Damn. I missed that. He wants the type of object and not the collisiontype. How really clumpsy of me ...,. Sorry. Forget my answer .... Maybe this would work then str GetEntityKey( entity, "class" ); At least the class is given in the map file (.sbx) like this Model { path="rimfrost_characters_celly.gmf" position=-433.687561,218.907288,-729.854370 rotation=-0.000000000,-0.000000000,0.000000000 scale=1.00000000,1.00000000,1.00000000 id=271943592 "class"="Model" "name"="celly" } a call would return "Model" as result Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
macklebee Posted November 16, 2011 Share Posted November 16, 2011 if he is just wanting the model, i think he should be able to simply use what Chris Paulson used and what I had just posted last week here: TBody GetMeshModel(TEntity entity) { std::string classname; while (entity!=0) { classname=GetEntityKey(entity,"class"); if (classname=="Model") { return entity; } entity=GetParent(entity); } return 0; } EDIT - I see you edited your response before I finished posting - but yes, that should basically work as it appears it worked for Chris and paratoxic... 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...
Roland Posted November 16, 2011 Share Posted November 16, 2011 Haha.. you were 2 seconds faster than me mackelbee Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Gabriel Posted November 17, 2011 Author Share Posted November 17, 2011 there is no access to this information faster than this method? Handling a string and a callback is a bit heavy as the process, right? TEntity what is it? other than a pointer, of course ^ ^ it points to a structure? I think hard enough that this information is not available elsewhere as a callback, I know that the processor is more powerful, it's still not a reason build cycle that could be used elsewhere. Am I wrong? Gabriel 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.