C Physics Simulation

0 views
Skip to first unread message

Ludivina Speed

unread,
Aug 3, 2024, 5:42:16 PM8/3/24
to freehthisphotert

There are around 50 different simulations in the source code, each of which has anexample filewhich is for development and testing. There are alsodownloadable versionswhich be used to show simulations offline (when not connected to the internet).

The rigid body physics engine is the mostsophisticated simulation shown here. It is capable of replicating all of the other morespecialized simulations. The physics engine handlescollisions and also calculatescontact forces which allow objects to push against eachother.

The myPhysicsLab simulations do not have units of measurements specified such asmeters, kilograms, seconds. The units are dimensionless, they can beinterpreted however you want, but they must be consistent within thesimulation.

Hi, my name is Erik Neumann, I live inSeattle, WA, USA, and I am a self-employed software engineer. I started developing thiswebsite in 2001, both as a personal project to learn scientific computing, and with avision of developing an online science museum. I grew up in Chicago near theMuseum of Science and Industry which I lovedto visit and learn about science and math.

I got a BA in Mathematics at Oberlin College, Ohio, 1978, and an MBA from Univerityof Chicago, 1984. My first software jobs were using the languageAPL which Ienjoyed for its math-like conciseness and power.

I was fortunate to get involved in the Macintosh software industry early on in 1985,joiningMacroMind, which becameMacromedia. I led the softwaredevelopment at MacroMind as VP of Engineering for 5 years. Our most significant productwas VideoWorks, which was renamed Director, and lives on today asAdobe Director. In the1980's, the interactive multimedia concepts that are so common today were new and beingdeveloped. VideoWorks was mainly an animation tool, but also incorporated programmableinteractivity. Our main competitors at that time were HyperCard, SuperCard, andAuthorware. Director was used in many different ways; I am most proud that it becamethe preferred way to prototype software user interfaces for a time during the 90's.Director was also used to develop the introductory "guided tour" tutorial that camewith the Macintosh in the early years. And of course, Director was used for all sortsof art, design, and marketing projects.

I went on to work at Apple Computer on new multimedia and user interface conceptsinvolving digital agents, animated user interfaces, speech recognition and distributedinformation access. In 1991, there was a sudden flurry of activity when Apple and IBMwere trying to set up a strategic partnership. I became involved in the super-secretnegotiations, and made the suggestion that what the world needed was a standard formultimedia that multimedia content creators could rely on to publish to (ultimatelythis is what HTML became). Based on these suggestions,Kaleida Labs was founded. Ourwork there developed a product calledScriptX,which turned out to be very similar to Sun's Java which was being developed at the sametime. ScriptX had goals of supporting all forms of multimedia: text, images, audio,video, animation; being cross-platform (Mac and Windows), interpreted, object oriented,with a garbage collector to manage memory.

I then moved to Seattle and turned my attention back to mathematics and science. Irelearned calculus by doing all the problems in my old college text book and tookfurther math classes at the University of Washington. I started developing this websiteas a way to practice what I was learning. I am now happy to use excellent tools such asHTML and JavaScript, and leave their development to others. I continue to work onphysics simulations, with several new ones in development.

Replicating physics can be extremely expensive, so in some cases, it is more appropriate to fake physics replication using interpolation, especially if the application is very physics heavy. Just something to keep a note of.

Replicating physics is all down to the actor setup. Child components from an actor class will not replicate their transform data (even if bComponentReplicates is true). The component which contains the physics data you want to replicate (such as a static mesh), must be the root component. It is a good idea to use StaticMeshActors for generic physics replication.

The problem I am currently facing in multiple scenes is that I still want different game objects in separate scenes to still interact with each other and the main scene which includes, lets say, the terrain while still maintaining the separate physics simulation.

Indeed I tested it out, I instantiated 100 primitive cubes with a rigidbody attached to it, each one in its separate physics scene, and simulated all 100 cubes at the same time every 0.02 ms, it heavily impacted performance spiking CPU for 4 ms to 120 ms and dropping my frames from 200 to 6-7 frames per second.

I think you will have better luck working with layers. You can set layers to not interact with certain other layers using LayerMasks, and Physics.IgnoreCollisions and things, to make your objects not touch each other, but still touch the terrain. For example my player spells do not interact with the player or with each other, but will hit buildings, monster, and the environment, etc.

I can handle small inaccuracies by fixing the client slightly without him noticing and I achieved that, but for now I need to choose a subset of rigidbodies to simulate while keeping others un-simulated until enough input buffer is available then advancing these ones to catch up in the simulation with the other rigidbodies, currently if one client had some packets lost or a connection problem and the available buffer for that client is now empty the whole server will have to wait for that client to feed us with his inputs for the lost frames and then continue the simulation, this is clearly unacceptable and will lead to fix each client, I can get around this by creating one separate scene for local physics and move rigidbodies with not enough buffer there to not include them in the simulation but when the input is received I will not be able to simulate multiple frames at the same moment without affecting other normal running connections and will lead to fix that client and moving him a huge step backwards.

Physion is a powerful free physics simulation software that can be used to support STEM education. With its intuitive interface and advanced physics engine, Physion provides an engaging platform for students to explore physical phenomena and experiment with different scenarios in a virtual environment.

One of the key features of Physion is its ability to create a wide range of interactive physics simulations using simple drawing tools. This means that users can easily create objects by drawing shapes such as rectangles, circles, polygons, regular polygons, and more. These objects can then be linked together using joint constraints such as axles, rods, pulleys, and springs to simulate real-world interactions.

Physion is not just a tool for creating fun physics simulations, it's also a valuable educational software that can help students to learn about the principles of physics and engineering. With its powerful physics engine, Physion provides a realistic environment in which students can explore the behavior of physical objects and experiment with different scenarios.

Whether you are a student, teacher, or hobbyist, Physion is the perfect tool for anyone interested in exploring the fascinating world of physics. With its intuitive interface, advanced physics engine, and support for scripting with JavaScript, the possibilities are endless. So why not give it a try and see what kind of amazing physics simulations you can create!

I am using Havok for physics and i want to simulate objects movement in miliseconds. I mean i need to fast forward time. This example with Ammo.js is what i need with Havok. I tried setTimestep method but nothing changes. My code here. How to fix this issue with Havok?

I am trying to create a Java package that can be used to write simulation programs.My goal is to create 'objects' like springs or solid objects like cubes and spheres. They will have mass, velocity, gravity etc. and they can interact with each other.

I have seen some simulation programs on www.myphysicslab.com but my problem is that I don't want to write different equations for different senarios. Is there any way to do this? I am new to programming.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages