Get game object width after the collision

After collision object1 and object2(both object1 and object2 are the instances of “block” game object.), i need to remove the extra part from the object 2. objects width are dynamic and it is equal to previous block width

To do that I need to set object2 “X” axis scale and set the new position. but to create a new scale, it requires object1 width.

obj2 new scale = ( obj2.X - (obj2.X - obj1.X)) / obj1.width

HOW I DO THIS? please help me.

this is the “collision_response”.

Come again, what is the problem? Width is predefined by you in the instance of the block, no? New width is old width * scale.
Or you can set the width to 1 and only use scale to determine width.

1 Like