About Store Forum Documentation Contact



Post Reply 
Object Type from Game::Obj (or PhysHit)
Author Message
Brainache Offline
Member

Post: #1
Object Type from Game::Obj (or PhysHit)
Hey there.. how can I get what type of object (OBJ_CHR, OBJ_ITEM, etc..) a base obj is?

ie: from the PhysHit structure populated during a raycast... what kind of object have I hit?

Also, I've tried limiting the objects hit by setting the groups parameter on raySkip with no luck..

tried using:
Physics.raySkip(start,end-start,L->ctrl.actor,&phit, OBJ_CHR)
and
Physics.raySkip(start,end-start,L->ctrl.actor,&phit, IndexToFlag(OBJ_CHR) )

Thanks!
05-24-2009 04:52 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
Re: Object Type from Game::Obj (or PhysHit)
Hi,

you can perform a C++ dynamic cast operator on the PhysHit::obj

and as for Physics testing functions
Physics.raySkip(start,end-start,L->ctrl.actor,&phit, OBJ_CHR)
Physics.raySkip(start,end-start,L->ctrl.actor,&phit, IndexToFlag(OBJ_CHR) )

the last parameter isn't object type (OBJ_TYPE), but it's a bit-combination of ACTOR_GROUP enum (described in Actor.h)
IndexToFlag must here also be used
05-24-2009 07:41 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
Re: Object Type from Game::Obj (or PhysHit)
if i would like to skip lets say player, in the camera modes tutorial.
How would i setup this raySkip? i found some grouping in the actor.h that says controller is 28..
is the bit flag needed?
please ellaborate

This way i get everything AG_STATIC.
What i want i everything but the player.
Code:
if(Physics.ray(pos,dir*1,&phys_hit,IndexToFlag(AG_STATIC))) // cast a ray from camera and check if it hits something
        {
06-25-2009 07:10 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
Re: Object Type from Game::Obj (or PhysHit)
you can disable player ray collisions just before the raytesting
Bool temp=player.ctrl.actor.ray();
player.ctrl.actor.ray(false);
Physics.ray(..);
player.ctrl.actor.ray(temp);

but remember that player can have many actors (like ragdoll, or custom ragdolls)

if you want to skip all characters you can do this

UInt chr_flag=IndexToFlag(AG_CTRL)|..; (other chr actor indexes;
Physics.ray(..., ~chr_flag);
06-25-2009 08:25 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #5
Re: Object Type from Game::Obj (or PhysHit)
ok this seems to work for me..
only reason i needed to do this was for the fps view.. the ray was instantly colliding with the head.
06-26-2009 03:01 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #6
Re: Object Type from Game::Obj (or PhysHit)
and ok.. how does this door work?
how do i define the turning?
how does it even work? i couldnt find any documentation about this..
if i have a custom door.. do i make an animation for it? or do i just define some hinge point?
06-26-2009 03:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #7
Re: Object Type from Game::Obj (or PhysHit)
Hi,

You've got tutorial for the doors.
See how the current door object is constructed and make similar meshes and phys bodies, you can always create custom door classess (these are just actor + hinge joint)
06-27-2009 12:34 AM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #8
Re: Object Type from Game::Obj (or PhysHit)
yeah ive done that.. not working..
any special stuff on the mesh that i might have missed?
06-27-2009 11:29 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #9
Re: Object Type from Game::Obj (or PhysHit)
in what way it is not working?

remember that you should set phys body properly (and dont make phys from mesh, because actor will need to be dynamic)
06-27-2009 11:43 AM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #10
Re: Object Type from Game::Obj (or PhysHit)
ok.. i got some action here by using the example wood door and just changing the mesh..
i guess i can work with that..
06-27-2009 12:03 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #11
Re: Object Type from Game::Obj (or PhysHit)
is it possible to export a two object setup.. and only one of them is the door..

i would like to include the doorframes on the same object..
06-27-2009 12:06 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #12
Re: Object Type from Game::Obj (or PhysHit)
for that you should create your custom door class.

for old door class please export 2 objects separately (1.frame, 2.door)
06-27-2009 12:20 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #13
Re: Object Type from Game::Obj (or PhysHit)
ok.. that works now.. anyway i could limit the opening direction?
not all doors open both ways.. ive tried to create a little big bigger phys object so that it could not open inside.


edit: actually this did the trick quite well when i got it right..
thanks again for your help..

im going to try adding a handle animation.
06-27-2009 12:40 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #14
Re: Object Type from Game::Obj (or PhysHit)
does the csSkel come automatically from world editor if i set it up there?

could not find any tutorials about bringing animations from editor..

edit:
i made two bones for the door, exported it and got the animation running in mesh editor.
i saved a skel and anim file.. in world editor i added them to the door.
after that i dont really know how to setup it running in the code. do i need to pickup the skeleton manually for the door?
06-27-2009 01:12 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #15
Re: Object Type from Game::Obj (or PhysHit)
door class actually doesn't use skeletons and animations, it is animated physically (according to door actor matrix)

if you'd like to make your own door class

you can take a look at the "advanced\animation\*" tutorials
take a look at "advanced\physics\*" tutorials too
06-27-2009 01:39 PM
Find all posts by this user Quote this message in a reply
Post Reply