Using setScale (Vector3f) on CollisionShapes

Its time to clear the air, as I don’t want people being mislead, with false information, in regards to this thread: http://hub.jmonkeyengine.org/groups/physics/forum/topic/why-no-rigidbodycontrol-setphysicsscale/



MeshCollisionShapes CAN have a scale correctly set, but it ONLY works when used on a geometry (not a node), it is CompoundCollisionShapes which can never be scaled (the type obtained when using imported models directly)



As you can see from the jME source code:

[java]/**

  • WARNING - CompoundCollisionShape scaling has no effect.

    */

    @Override

    public void setScale(Vector3f scale) {

    Logger.getLogger(this.getClass().getName()).log(Level.WARNING, “CompoundCollisionShape cannot be scaled”);

    }

    [/java]



    When you import a model from blender, it often comes as a Node (even if it only contains 1 mesh), which is by de-facto automatically converted to a CompoundCollisionShape. So when you try to scale this it won’t work! as there are no suitable scaling methods for CompoundCollisionShapes.



    There is a useful technique for being able to scale an imported model’s collisionshape at any time.

    First you must navigate to the geometry (important) and then attach the physics control to that, and then it can be scaled correctly. An example is shown below:

    [java]

    // Doesn’t scale

    Spatial model = assetManager.loadModel(“Models/MonkeyHead.j3o”); // This contains Node -> Geometry (name = “MonkeyHeadGeom”)

    model.addControl(new RigidBodyControl(0));

    // Won’t work as this is now a CompoundCollisionShape containing a MeshCollisionShape

    model.getControl(RigidBodyControl.class).getCollisionShape().setScale(new Vector3f(2, 2, 2));

    bulletAppState.getPhysicsSpace().add(model);



    // Works fine

    Spatial model = assetManager.loadModel(“Models/MonkeyHead.j3o”); // Same Model

    Geometry geom = ((Geometry) ((Node) model).getChild(“MonkeyHeadGeom”)); // IMPORTANT : It must be cast to a Geometry for this to work

    geom.addControl(new RigidBodyControl(0));

    geom.getControl(RigidBodyControl.class).getCollisionShape().setScale(new Vector3f(2, 2, 2)); // Works great (scaling of a MeshCollisionShape)

    bulletAppState.getPhysicsSpace().add(geom);

    [/java]



    With the corresponding output below:







    Although simple, it is overlooked.



    I knew Phate would not be able to figure this out, and in pure rage he deleted his account (although i give @normen the credit for that :)). So we can all move on with our lives, and build a happier community :slight_smile: where we all dance around with the butterflies in open fields and sing sweet nothings into each others ears.



    I will also update the wiki at some point as there is nothing currently mentioned there about scaling collision shapes.
@wezrule said:
I knew Phroot would not be able to figure this out, and in pure rage he deleted his account

Phate not Phroot....

I pretty much auto updated that as soon as I posted it :slight_smile: and went whoops. You read too fast :stuck_out_tongue:

Well from what I read the problem wasn’t scaling a single collision shape. It was having multiple objects on the scene (trees in this case) all sharing the same mesh and collision shape (for efficiency). Each of those trees is positioned in the scene with a different position, rotation and scale. He was able to do this with the different position and rotation, but couldn’t do it with scale without duplicating the collision shape for each tree - which he was trying to avoid. That seems like a very reasonable thing to want to do, avoiding duplicating identical data is a good thing.



His attitude could do with quite a bit of work too but he wasn’t the one calling people names or swearing at them so as I said in my post, no-one comes out of it looking good. :wink: I’ve no idea if there is some sort of history between the four of you but honestly it looked like a couple of playground bullies ganging up to jump on someone. Nearly as pathetic as opening a new thread referring to a previously locked one in order to continue getting some digs in.



If you wanted to “clear the air” then this post could have been done without any reference to the previous one, and certainly without any personal references.



Right, I’m out. Party on dudes, and be excellent to each other :wink:

1 Like

Yeh and as was said that’s not possible. I’m just cleaning the air with the stuff I said, and it wouldn’t have made sense unless without referring to the other thread. To be clear, I have nothing against the guy. He has even made some worth while contributions a while back, FXAA and others. And then decided to promptly remove all his threads about contributions so no one could use them or get any help from them.



And it wasn’t us bulling him, if u read the thread he just started throwing insults at everyone and we responded fairly. He continued, and normen was giving him the right info, and still insults came



But anyways, this thread was to help people about any misconceptions that may have arose from the other one from stuff I said.

Erm, no.



It’s hard to see now as his posts are gone but from what I remember he said someone was wrong (not insulting, just disagreeing) and said you had no idea what you were talking about (yes, that was insulting). As I said his attitude needed work and he really didn’t help his own case. It’s worth noting that the first reply to his post (before it was edited) was a completely unhelpful “yes” though which probably wound him up in the first place…



In response he got called (by three different people over four different posts):

Lazy

Whiner (paraphrasing a much longer post)

Asshole

And told to fuck off.



He didn’t throw insults at everyone. He didn’t swear. That escalation was all done by other people. It doesn’t matter who throws the first turd, once shit starts flying everyone ends up stinking.



Ideally everyone would be able to shake hands, apologise to each other, and move on. It’s a bit late now though so I’m not going to reply any more and will let this thread disappear (quickly I hope).

1 Like
@zarch said:
Erm, no.

It's hard to see now as his posts are gone but from what I remember he said someone was wrong (not insulting, just disagreeing) and said you had no idea what you were talking about (yes, that was insulting). As I said his attitude needed work and he really didn't help his own case. It's worth noting that the first reply to his post (before it was edited) was a completely unhelpful "yes" though which probably wound him up in the first place...

In response he got called (by three different people over four different posts):
Lazy
Whiner (paraphrasing a much longer post)
Asshole
And told to fuck off.

He didn't throw insults at everyone. He didn't swear. That escalation was all done by other people. It doesn't matter who throws the first turd, once shit starts flying everyone ends up stinking.

Ideally everyone would be able to shake hands, apologise to each other, and move on. It's a bit late now though so I'm not going to reply any more and will let this thread disappear (quickly I hope).

Please, you consider "So why do you do this, to make applications inefficient?" a normal question? I think I even contained myself very much. He will just have to accept that being mad at the world because you don't like the circumstances will not gain you anything. Also "That answer is completely wrong".... Lets put it this way, if *I* put a "this question is completely wrong" in threads people blame me for being aggressive. Ofc I have to give normal answers.

Edit: Also if I hadn't put the "Edit" before that you (and he) wouldn't even have noticed it was an edit in the first post. He wanted to know if theres a reason, I said there is, still he commenced to demand it be different. Idiot, really.

I think he also asked why… to which no satisfactory answer was given that I saw. I was even looking for a definitive “bullet itself doesn’t support such a thing” but never really saw that directly. Of course, I stopped following the thread once the insults started flying. He was being a bit of a jerk and instead of shrugging it off the community chose to respond in kind and things escalated. Unproductive.



Many times when people ask “Is there a reason?” they actually want to know the reason. Not just “yes”.

2 Likes
@pspeed said:
I think he also asked why... to which no satisfactory answer was given that I saw. I was even looking for a definitive "bullet itself doesn't support such a thing" but never really saw that directly. Of course, I stopped following the thread once the insults started flying. He was being a bit of a jerk and instead of shrugging it off the community chose to respond in kind and things escalated. Unproductive.

Many times when people ask "Is there a reason?" they actually want to know the reason. Not just "yes".

Thats why I edited it in and I bet nobody read it before that. Anyway the headline asks "why" thats right, from the content of the post I thought he just wanted the info so I thought that instead of the shit that did happen this would happen:

"hey, this doesn't work, is this right? heres some code:"
"yeah, that won't work"
"thanks"
1 Like

The original question as per the title “why-no-rigidbodycontrol-setphysicsscale/”. Was swiftly answered by normen, that you can do that with CollisionShapes, which would have been easily found by checking the documentation. But instead he replied with “no thats wrong” and the -1 he gave normen as a result, made me and Phoenix respond, with “actually thats right”. He got more angry claiming he was right, then it escalated to why doesn’t cloning work, then mesh shapes, then scaling of the same mesh shapes, then why doesn’t it do it, insulting many people along the way. We only started the rebuttle at the end, once we got fed up with him.



He then decided to delete all his posts, and edit all his threads away, and then delete his account, so no one would be able to get any help from threads/posts he had made (although he already deleted his contribution threads a while ago). Sums up his personality right there (actions speak louder than words) .



I edited the wiki with information I provided in this thread, none-the-less:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics

So… to sum up. What I gathered was:



You can reuse collision shapes:

-if you move the object

-if you rotate the object



But you can’t reuse a collision shape:

-if you scale the object



I never saw the answer of why that is true. It was clear to me from the first post that he wanted to reuse collision shapes. I still don’t know why that won’t work. Is it just a bullet limitation that scaling is not part of its transforms? That right there would have been a clear answer: “Because we’d have to rewrite bullet to make it pay attention to something other than just translation and rotation.”

@pspeed said:
Is it just a bullet limitation that scaling is not part of its transforms? That right there would have been a clear answer: "Because we'd have to rewrite bullet to make it pay attention to something other than just translation and rotation."

@normen said:
As I explained multiple times, the scale property is on the collision shape in bullet. Go complain on their forums please and let them educate you about why thats necessary.

Collision shape = mesh in this case, that much he got from what I gathered. Just not that you can create and access them w/o any constructor magic it seemed, that slipped my attention in the right moment.

I’m doing this separately because I’m trying to keep the technical discussion separate. Though I do think it’s ironic that the thread that was supposed to clear up the technical side of things keeps mentioning the other stuff… by the person who started the thread in the first place. :wink:


@wezrule said:
The original question as per the title "why-no-rigidbodycontrol-setphysicsscale/". Was swiftly answered by normen, that you can do that with CollisionShapes, which would have been easily found by checking the documentation.


The question to me was pretty clearly "why". But ok. I kept waiting for something on whether it was a bullet limitation or a JME API limitation. And note, regardless of the immediate edit, he would have seen the single "yes" answer in his e-mail.

@wezrule said:
He then decided to delete all his posts, and edit all his threads away, and then delete his account, so no one would be able to get any help from threads/posts he had made (although he already deleted his contribution threads a while ago). Sums up his personality right there (actions speak louder than words) .


Well, he was kind of asked to... by you in fact. I'd have probably done the same given how rapidly the community escalated the thread.
  • Pokes nose in here.
  • Notices the stench.



    Come on people. The guy left the building. Stop trying to deflect the blame elsewhere. We’re all responsible of what happened. Yes, me too even if I’ve not read the original thread at all. Arguing who said what and who offended the other more is irrelevant. I highly doubt Phate will come back here to add to the discussion. As we say around here: absentees are always wrong.



    Unless it’s technical and answers the original question (because there seem to be a lot of confusion on this), I say just move the hell along.


  • Leaves in a hurry.
2 Likes

I really saw it coming. Kind of follows a trend that has happened a couple times here… and probably on most open source projects.



Some people do great stuff, putting all their heart in their work. After a certain amount of achievements and praises, their ego becomes somewhat as important as their works.

They become more difficult to handle, get an answer that could have been more diplomatic and then ragequit.



This crowd is made of technicians… selection isn’t based on people skills, for technicians, so we tend to not be the most sensitive people. Also, if you are a PR, how you phrase something is as important as the real content. Not the case for technicians, so less work is put into the phraseology. We should accept that. Some people answer 20 questions a day, so yes, there will be answers that could have been phrased better. But we are not poets… it’s the meat we should be after, not the sauce.



But changing a crowd is not something you can really do, so no solutions there, apart from maybe a sticky.

Maybe some threads could be put on “pause” and problems resolved out of public scrutiny. When multiple people start getting aggressive, the chances of a ragequit goes up significantly… and while a ragequit ultimately, mostly hurts the ragequitter, it doesn’t help the project nor the people using the project.



Pausing could be locking the thread (and hiding it, ideally) and sending a message saying a discussion to calm things down is needed and the thread will be unlocked after the discussion occured. Mind you, they have a pretty tight schedule so it is our duty as users of the project to minimize the need for that.



But really, as technicians, we should be results oriented. Ragequitting has never obtained any technical results. Even for the ego, it is a failure… standing your ground is way more satisfying. Heck, shrugging it off is more satisfying.



Also, a ragequitter should pause and think: is he/her really better out of the project? And we should make it clear they can come back (heck, they should). We are all trolls here, it is our nature to be stoupid sometimes. And the way of trolls is to keep piling up the heat, hence the need for pausing (with a message).

6 Likes