Jump to content

Recommended Posts

Posted

My character walks straight thru this door. Am I missing something?

 

 

 

void setup_door()

{

door.pivot = Pivot::Create();

door.pivot->SetCollisionType(Collision::Prop);

 

 

door.pivot->SetPosition(-239.9,9.46,316.03);

door.model->SetPosition(door.pivot->GetPosition());

door.pivot->SetMass(0.0);

}

EDIT: The door is in closed position

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

If the door is a model, does the door have a phy file, or does it have a shape? That's the first thing I would think of. Another question is, is the door a child of another object (do you have to click + to get to it)?

Posted

The door is placed in position with the code, not in the editor.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

What is door->model? A 3D model I assume? Does it have a physics shape attached to it? With external models you have to assign a physics shape to it yourself (or csg). Probably best to make a prefab of the door where you give it a shape or attach csg with a script attached to it so the csg won't get collapsed.

Posted

Does this look ok.

 

 

 

door.model->SetPosition(-239.9, 9.46, 316.03);

Shape* doorshape = Shape::Box();

door.model->SetShape(doorshape);

door.model->SetCollisionType(Collision::Prop);

door.model->SetMass(0.0);

doorshape->Release();

 

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

Yeah I was considering that. It works ok as it is, but I may try placing it in the editor and use its classname as reference.

Thanks for help.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

@Cassius :

 

door.pivot->SetCollisionType(Collision::Prop);

A pivot is an empty object, it don't need collisions.

 

Why not creating all in the editor instead coding ? I mean place a door model and physics, place the pivot as child object of door, than use simple code , for example : door.FindChild("pivotDoor")

The advantage is that visually you can see and adjust your pivot of your door, and save door with script and child pivot as a re usable prefab.

Stop toying and make games

Posted

Yougroove he is using c++ so I would assume that he has a door class that has a pivot member and a model member. Even in lua you can create a pseudo class and create a door without the joint feature. It's a method of containing everything that is related to the door in one compact self contained package.

Posted

I meaned , it could have pivot child and door in the editor and save them as prefab, than re use them in the editor by duplicating them.

-Design, physics, pivot placement in the editor and save as prefab

-Find prefab instance in C++ and use FindChild (pivot child in the prefab object) in C++

Just another way of working.

Stop toying and make games

Posted

The idea in my game is this: Main character walks into room. Enemy closes door from outside locking main character in rom.

The door is open and then closes.After that it is never opened again.A sliding door might be easier but I will try normal door first using code.

 

II don;t think I need pivot.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

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