Page MenuHomeFeedback Tracker

Add a "getCenterOfMass" command
Closed, ResolvedPublic


We currently have "setCenterOfMass" which is incredibly useful, for example, in simulating a center of mass shift in combination with attachTo.

But you currently have no way of saving the old center of mass so you can revert it on detach or move the center of mass relatively in relation to the current center of mass.


Legacy ID
Additional Information

Sample syntax: getCenterOfMass <object>

Sample output would be an array in the same format which setCenterOfMass expects.

The command from VBS2:

Event Timeline

Sniperwolf572 edited Additional Information. (Show Details)
Sniperwolf572 set Category to Scripting.
Sniperwolf572 set Reproducibility to N/A.
Sniperwolf572 set Severity to None.
Sniperwolf572 set Resolution to Fixed.
Sniperwolf572 set Legacy ID to 204684585.May 7 2016, 5:09 PM

Wouldnt the default center of mass be [0,0,0]?

I don't think it is as [0,0,0] refers to the center of the model not the initial center of mass. Mass can be distributed in O2 across the model and shifted anywhere from the center.

Simple way to confirm this is to place yourself as BLUFOR > NATO > Cars > HEMTT then drive in circles and observe the behavior. Then set the center of mass to [0,0,0] and try it again, the center of mass then seems to shift to the center of model and the vehicle stops behaving in the same manner.

Either way, even if that was the case and [0,0,0] was always the default center of mass, if you need to relatively shift the mass in any direction, you can't guarantee that the other scripts/addons that you have no control over have not already moved it somewhere else.

In this case this command is needed even more because without it, how would you know how much to shift mass if you don't know the original value. Upvoted.

In this case this command is needed even more because without it...

Yep, that's what my argument in the description of the ticket is about. :)

If you shift it anywhere at all (using trial and error and see what feels best with the attached load), you have no reference as to where the old one was if you need to revert it.

Now just to demonstrate how awkward it is I've made a workaround to this problem

As you can see a complement command to setCenterOfMass is much needed.

@Sniperwolf572, you should add this here:
You are basically requesting the getCenterOfMass command from VBS2.

New command getCenterOfMass as well as getMass is added. This could be closed now.

Yup, useful offset is returned. Marking as resolved.

Mass-close of resolved tickets not updated in last two weeks.