What type of force/transform should I use?

Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

What type of force/transform should I use?

Post by Neirdan »

I have a cube (red) and inside there is a cube (blue). They're rigid bodies.
The big red cube is not affected by gravity and has an infinite mass (to avoid that it moves when something interacts with it).

I want to translate that cube from point A (0,0,0) to point B (3,0,0) over 3 seconds, with let's say 60 frames per second.
The small blue cube shouldn't move, thanks to friction.
Image

What kind of force should I apply to the big cube, considering it's infinite mass?
Should I remove infinite mass and put a "very big mass" then apply an impulse to it and kill it's inertia once it has reached it's destination?
If so, how can I make that big cube immune (won't react) to other objects bumping into it?
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: What type of force/transform should I use?

Post by Basroil »

You don't, you just move it kinematically. Kinematic objects just do what you tell them to, but at the same time are still going to push, drag, or otherwise cause effects in the dynamic objects (think newton's action reaction if you didn't get a reaction)
STTrife
Posts: 109
Joined: Tue May 01, 2012 10:42 am

Re: What type of force/transform should I use?

Post by STTrife »

I don't think the blue cube will move along if you make the big cube a kinematic object and just update the position.
(I assume with 'The small blue cube shouldn't move, thanks to friction.' you mean that it should be dragged along with the bug cube because it rests on it?)
Not sure what the best way would be to make it react in the way you want.
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: What type of force/transform should I use?

Post by Neirdan »

Yeah it's quite hard to find the best solution since:

-I want friction between the small blue cube and the big red cube
-I want to move the big red cube somehow (but with what? proceedtotransform, translate, force, impulse, velocity?)
-I want the big red cube to collide with others but to not react
bdpdonp
Posts: 3
Joined: Fri May 17, 2013 1:08 am

Re: What type of force/transform should I use?

Post by bdpdonp »

I would think an infinite mass with a set velocity. This will have the red cube moving. The red box would still need to be a kinematic object, but infinite or very high mass. You will have to set the velocity directly for proper effects.
STTrife
Posts: 109
Joined: Tue May 01, 2012 10:42 am

Re: What type of force/transform should I use?

Post by STTrife »

can you set velocity on a kinematic object?
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: What type of force/transform should I use?

Post by Neirdan »

Technically you -should ?- be able to, (at least that's how it works in Box2D), but so far I didn't succeed to.
When I set a velocity (to the big red cube) my small cube inside has weird results but the (big red cube) kinematic object doesn't move with a low, high and infinite mass.
Last edited by Neirdan on Mon Jul 01, 2013 8:20 pm, edited 1 time in total.
STTrife
Posts: 109
Joined: Tue May 01, 2012 10:42 am

Re: What type of force/transform should I use?

Post by STTrife »

I thought you would only move the big red cube, and the blue one just rests on that? Why make the small cube kinematic then? In that case I would say:
make the red cube kinematic (or extreme large mass), and set the velocity manually. Then the small cube should be a normal rigidbody that rests on it, with friction (both objects need friction I think).
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: What type of force/transform should I use?

Post by Neirdan »

Edited my last message which apparently wasn't clear.
I don't think switching the big red cube from kinematic to rigid/dynamic would be the right solution.
I am gonna apply the same motion state to my dynamic object when moving the big one.
Since I'm not playing with many objects, it won't be a problem.