Jump to content

Recommended Posts

Posted

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

Posted

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

Roland Strålberg
Website: https://rstralberg.com

Posted

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

Roland Strålberg
Website: https://rstralberg.com

Posted

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

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

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

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

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.

×
×
  • Create New...