Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

[ad_1]

I am utilizing Cocos2dx and the inbuilt Chipmunk physics engine, and at present I’ve obtained my PhysicsBodys’ supplies arrange with:

Density=0
Restitution=1
Friction=0

with a view to get totally elastic collision, and maintain transferring our bodies transferring at a continuing pace. This works nice in the event that they collide towards a static factor, like a wall, not a lot in the event that they collide with different transferring objects.

I am transferring these our bodies by making use of an preliminary pressure:

Vec2 velocity = moveDirection.getNormalized()*moveSpeed - myPhysicsBody->getVelocity();
Vec2 newForce = myPhysicsBody->getMass()*velocity / deltaTime;
myPhysicsBody->applyForce(newForce);

So I am guessing that although their supplies would end in totally elastic collisions, the transferring objects each carry an affect pressure, this modifies the ensuing pressure into one with completely different magnitude? All these transferring our bodies have the identical mass.

At the moment I am manually catching the affect begin and manually producing the ensuing pressure in the precise directing, and utilizing the item’s pace to use it with the identical earlier magnitude, successfully overriding Chipmunk’s collision decision.

Is that this one of the simplest ways to do that, or can I configure my our bodies in a manner that permits Chipmunk collision decision to realize the identical impact? I am a bit rusty on my physics.. heh..

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *