About Store Forum Documentation Contact



Post Reply 
[Solved] Problem with actor
Author Message
Seba Offline
Member

Post: #1
[Solved] Problem with actor
I started from some basics physics tutorials but i have problem with settings actor position. As you can see on first screen from tutorials when box position is set to Vec(0,-2,0) ground display at Vec(0,0,0) but all matrices are moved down.
   
The same problem i have on my application. When box from which I create ground is set to Vec(0,0,0) it works good. But when is set to Vec(0,-2,0). I have the same problem. Blue box is a box from which i create ground actor.
   
Second problem I have with Controller PhysMtrl. I was able to set PhysMtrl for other objects but for Controller it's allways set to default one.

Thanks for help.

//Edit
Screen from tutorial from old free version
   
(This post was last modified: 11-27-2015 07:52 PM by Seba.)
11-23-2015 10:42 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Problem with actor
Hi,

The controller material is managed by the Controller class, if you specify CSS_MATERIAL in the Physics.create method, you can try setting a different CSS_* enum to that method.

As for the first problem, could you please try describing what is the issue exactly?
Are you drawing actors manually? maybe you need to call 'SetMatrix()' before drawing the actors?
If you do Physics.draw then you don't need that, but call SetMatrix before manual drawing.
11-26-2015 03:12 AM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #3
RE: Problem with actor
Thanks for help with Controller it works now.

For the first problem. The first screen is from the latest engine version tutorial Joints 2. I only added matrix.draw. The last screen is from the old version EE 1.0 and for me this screen is correct. The code is the same but result for Physics.draw() is different. Problem for me is that Actors are drawn in different position compare to which position is set. When I use manual draw I get the same result as on last screen:
Code:
SetMatrix(ground.matrix());
   ground.draw();
   SetMatrix(box.matrix());
   box.draw();
   SetMatrix(MatrixIdentity);

My scene is on second screen, white big box is ground create from blue box. But when I draw actor with Physics.draw() and box.draw() I get result as on second screen for me this two drawings should be in one place.
Code:
//Init
   ground.create(Box(15, 1, 15, Vec(0, -2, 0)), 0);
//Draw
   Physics.draw ();
   ground.matrix().draw();
   box.matrix().draw();
   Box(15, 1, 15, Vec(0, -2, 0)).draw(BLUE);

Thanks for help and advices.
11-26-2015 08:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Problem with actor
Hi,

I think this could be because Actor.draw may change the 'SetMatrix'.
So for now you may need to call 'SetMatrix' after Physics.draw and after Actor.draw.

I'll see if I can remove changing SetMatrix inside Actor.draw

If this is not the issue, can you attach the sample project to reproduce the issue?
11-27-2015 11:36 AM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #5
RE: Problem with actor
Thanks everything is working now.
This resolve problem:
Code:
Physics.draw(); // draw physical actors
   SetMatrix(MatrixIdentity);

Maybe you should update 11 - Physics -> Join 2 Draw method to:
Code:
void Draw()
{
   D      .clear();
   Physics.draw ();
   SetMatrix(MatrixIdentity);

   joint_pos.draw(RED);                             // draw joint position
   D.line(GREEN, joint_pos, joint_pos+joint_dir*3); // draw a line from joint position and it's direction

   D.text(0, 0.9, S+"Press Left / Right to change velocity");
   D.text(0, 0.8, S+"Press Up / Down to change velocity, the object won't move because of the joint");
  
}
To display result correctly.

Again Thanks for help.
11-27-2015 07:50 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: [Solved] Problem with actor
Quote:Maybe you should update 11 - Physics -> Join 2 Draw method
Many thanks, I will do that smile
11-29-2015 04:21 AM
Find all posts by this user Quote this message in a reply
Post Reply