Giter VIP home page Giter VIP logo

Comments (8)

liabru avatar liabru commented on May 2, 2024

This may depend on your particular setup.

Can you provide a jsfiddle please?

from matter-js.

spacemeowx2 avatar spacemeowx2 commented on May 2, 2024

http://jsfiddle.net/wafo2qga/1/
It's used to be C/S structs. Matter.js running on my server and send frame data to a browser. The task of the browser is to draw frames. So the code is strange.
http://203.195.196.109:8899/game.html

from matter-js.

liabru avatar liabru commented on May 2, 2024

It looks like you're only applying a (small) force for a single frame?
I think you need to apply a bigger force over a number of frames to get the acceleration you're looking for.

But actually, what you probably need to use is Body.setAngularVelocity which is instantaneous, where as forces are much slower acting.

from matter-js.

spacemeowx2 avatar spacemeowx2 commented on May 2, 2024

No.. You didn't get my point.
http://jsfiddle.net/wafo2qga/2/

Body.applyForce(boxA, Vector.add(boxA.position,{x:80,y:0}), {x:0,y:-0.5});

A 'small' force let the box jump so high without any rotation. Isn't it abnormal?

from matter-js.

liabru avatar liabru commented on May 2, 2024

I do get your point, it does seem a little strange that there's no rotation given the change in linear velocity.

So there may be an issue with angular force application. I'll investigate further, thanks.

from matter-js.

mattgrayisok avatar mattgrayisok commented on May 2, 2024

I ran into this issue today too. Fix seems to be to remove * body.inverseInertia from Body.js:570.

Based on my rather limited understanding, this makes sense based on the physics because the torque isn't proportional to inertia, however the angular momentum that results from it is.

from matter-js.

jstoeffler avatar jstoeffler commented on May 2, 2024

Wow, I was having so much trouble getting things working, I thought it was because I didn't understand what was going on, but turned out by removing * body.inverseInertia everything makes sense now !

Is the bug still here? Or is it just me?

from matter-js.

liabru avatar liabru commented on May 2, 2024

Fixed in the latest master build, thanks guys.

from matter-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.