Page 1 of 1

How to change center of mass

Posted: Sat Dec 14, 2019 11:15 am
by parapoohda
I want to change center of mass.
Is compond object is only way to change center of mass?
Are there other way?
Thank you. :D

Re: How to change center of mass

Posted: Sat Dec 14, 2019 7:53 pm
by Norbo
Yup, right now, Compound is the right choice. Changing the center of mass is equivalent to offsetting the collidable, so rather than having a dedicated 'collidable offset' on everything I just let the Compound handle it. Notably, the Compound (as opposed to the BigCompound) has effectively no overhead for single shapes since it has no acceleration structure.

Re: How to change center of mass

Posted: Tue Dec 17, 2019 9:44 am
by parapoohda
Thank you.:3

Re: How to change center of mass

Posted: Tue Mar 03, 2020 4:00 am
by parapoohda
Now I try to create a hitbox but seem center of mass is a little off.
1 Are there ways to assign center of mass of hull?
2 Or I want to make a point (0,0,0) center by compound object. How I get location of a point (0,0,0) from the center of mass.
Here is my points for make hull

Code: Select all

points.AllocateUnsafely() = new Vector3(0f,0f,0f);
points.AllocateUnsafely() = new Vector3(0.70710677f,0.70710677f,0f);
points.AllocateUnsafely() = new Vector3(1.847759f,0.7653669f,0f);
points.AllocateUnsafely() = new Vector3(1.847759f,-0.7653669f,0f);
points.AllocateUnsafely() = new Vector3(0.70710677f,-0.70710677f,0f);
points.AllocateUnsafely() = new Vector3(0f,0f,1f);
points.AllocateUnsafely() = new Vector3(0.70710677f,0.70710677f,1f);
points.AllocateUnsafely() = new Vector3(1.847759f,0.7653669f,1f);
points.AllocateUnsafely() = new Vector3(1.847759f,-0.7653669f,1f);
points.AllocateUnsafely() = new Vector3(0.70710677f,-0.70710677f,1f);

Re: How to change center of mass

Posted: Tue Mar 03, 2020 7:54 pm
by Norbo
1 Are there ways to assign center of mass of hull?
Same as anything else- stick them in a Compound with an offset. If you want to know the center that the ConvexHull got recentered to, the ConvexHullHelper outputs it in the 'center' out parameter.
2 Or I want to make a point (0,0,0) center by compound object. How I get location of a point (0,0,0) from the center of mass.
Not sure what you mean. If you mean making a particular point a compound's center of mass, it's always (0,0,0) in the compound's local space. To make the center of mass of a compound shift relative to its convex children, shift the children.

Re: How to change center of mass

Posted: Wed Mar 04, 2020 2:44 am
by parapoohda
I mean I want point (0,0,0) in points.AllocateUnsafely to be center.(I want point with x 0.70710677f to be border of cylinder radius 1)
After I move x to 1.847759f - 0.70710677f.
I succeed.
Thank you.