123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>jMonkeyEngine 3 Tutorial (13) - Hello Physics :: jMonkeyEngine Docs</title>
- <link rel="canonical" href="https://wiki.jmonkeyengine.org/docs/3.8/tutorials/beginner/hello_physics.html">
- <link rel="prev" href="hello_effects.html">
- <link rel="next" href="../concepts/best_practices.html">
- <meta name="keywords" content="beginner, intro, physics, documentation, input, model, control">
- <meta name="generator" content="Antora 3.0.1">
- <link rel="stylesheet" href="../../../../_/css/site.css">
- <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
- <meta property="og:description" content="jMonkeyEngine 3 Tutorial (13) - Hello Physics">
- <meta property="og:title" content="jMonkeyEngine Docs">
- <link rel="stylesheet" href="../../../../_/css/site-extra.css">
- <link rel="stylesheet" href="../../../../_/css/vendor/docsearch.min.css">
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->
- <link rel="icon" href="../../../../_/img/favicon.ico" type="image/x-icon">
- </head>
- <body class="article">
- <header class="header">
- <nav class="navbar">
- <div class="navbar-brand">
- <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
- <img alt="" src="../../../../_/img/jme-logo.png" height="32" type="image/x-icon">
- </a>
- <div class="navbar-item hide-for-print">
- <input id="search-input" type="text" placeholder="Search docs">
- </div>
- <button class="navbar-burger" data-target="topbar-nav">
- <span></span>
- <span></span>
- <span></span>
- </button>
- </div>
- <div id="topbar-nav" class="navbar-menu">
- <div class="navbar-end">
- <div class="navbar-item theme-switch-wrapper">
- <label class="theme-switch" for="checkbox">
- <input type="checkbox" id="checkbox" />
- <div class="slider round"></div>
- </label>
- </div>
- <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
- </div>
- </div>
- </nav>
- </header>
- <div class="body">
- <div class="nav-container" data-component="docs" data-version="3.4">
- <aside class="nav">
- <div class="panels">
- <div class="nav-panel-menu is-active" data-panel="menu">
- <nav class="nav-menu">
- <h3 class="title"><a href="../../documentation.html">JME</a></h3>
- <ul class="nav-list">
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../../documentation.html">Getting Started</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="https://javadoc.jmonkeyengine.org/v3.4.1-stable">JavaDoc</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../../release.html">Release Guide</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="beginner.html">Beginner Tutorials</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_simpleapplication.html">Hello SimpleApplication</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_node.html">Hello Node</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_asset.html">Hello Asset</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_main_event_loop.html">Hello Update Loop</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_input_system.html">Hello Input System</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_material.html">Hello Material</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_animation.html">Hello Animation</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_picking.html">Hello Picking</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_collision.html">Hello Collision</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_terrain.html">Hello Terrain</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_audio.html">Hello Audio</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="hello_effects.html">Hello Effects</a>
- </li>
- <li class="nav-item is-current-page" data-depth="2">
- <a class="nav-link" href="hello_physics.html">Hello Physics</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Key Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/best_practices.html">Best Practices</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/optimization.html">Optimization</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/faq.html">Frequently Asked Questions</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/math_for_dummies.html">Math for Dummies</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/math.html">Math overview</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/math_cheet_sheet.html">3D math "cheat sheet"</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/rotate.html">3-D Rotation</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/math_video_tutorials.html">Math video tutorial series</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/the_scene_graph.html">The Scene Graph</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/scenegraph_for_dummies.html">Scene Graph for Dummies</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/terminology.html">3D Graphics Terminology</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../concepts/transparency_sorting.html">Transparency Sorting</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Articles and How-to’s</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">How to Model</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../how-to/modeling/3dsmax/3dsmax.html">3dsmax</a>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../how-to/modeling/blender/blender.html">Blender</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/blender_buffer_clearing.html">Buffer Clearing</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/blender_gltf.html">Export as GlTF</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/blender_ogre_export.html">Export as Ogre XML</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/blender_ogre_compatibility.html">Ogre Compatibility</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/makehuman.html">MakeHuman</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/makehuman_blender_ogrexml_toolchain.html">MakeHuman toolchain</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">How to Animate</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Mixamo</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/modeling/blender/mixamo.html">Blender Models</a>
- </li>
- <li class="nav-item" data-depth="4">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Video</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="5">
- <a class="nav-link" href="https://youtu.be/jHgAgTWIers?list=PLv6qR9TGkz8RcUr-fOHI2SksWA4BAU9TS">Part 1- Download Model</a>
- </li>
- <li class="nav-item" data-depth="5">
- <a class="nav-link" href="https://youtu.be/GQJSrOpNQwI?list=PLv6qR9TGkz8RcUr-fOHI2SksWA4BAU9TS">Part 2- Rig and Animate</a>
- </li>
- <li class="nav-item" data-depth="5">
- <a class="nav-link" href="https://youtu.be/JzRe2Dxbcmc?list=PLv6qR9TGkz8RcUr-fOHI2SksWA4BAU9TS">Part 3- Import to JME</a>
- </li>
- <li class="nav-item" data-depth="5">
- <a class="nav-link" href="https://youtu.be/8wwDRDJop7k?list=PLv6qR9TGkz8RcUr-fOHI2SksWA4BAU9TS">Part 4- Play Animation</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../how-to/debugging.html">Debugging with Wireframes</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../how-to/util/free_skymaps.html">How to create free skymaps</a>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Java Tips</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../how-to/java/localization.html">Localization</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../how-to/java/swing_canvas.html">Swing Canvas</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../how-to/java/logging.html">Logging</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../how-to/java/read_graphic_card_capabilites.html">Read Graphics Capabilities</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Articles</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Physically Based Rendering</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/articles/pbr/pbr_part1.html">PBR – Part one</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/articles/pbr/pbr_part2.html">PBR – Part two</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../how-to/articles/pbr/pbr_part3.html">PBR – Part three</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Core Engine</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/simpleapplication.html">SimpleApplication</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/system/appsettings.html">AppSettings</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Controlling Game Logic</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/update_loop.html">Update Loop</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/state/application_states.html">Application States</a>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../core/scene/control/custom_controls.html">Custom Controls</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Video</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="https://www.youtube.com/watch?v=MNDiZ9YHIpM">Control any scene node</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="https://www.youtube.com/watch?v=-OzRZscLlHY">Control a character</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="https://wiki.jmonkeyengine.org/Scenes/SDK-UsecaseDemo_1.zip">Video Source Code</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/multithreading.html">Multithreading</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Scene Graph</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/scene/traverse_scenegraph.html">Traverse SceneGraph</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/scene/spatial.html">Spatial: Node vs Geometry</a>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../core/scene/mesh.html">Mesh</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/scene/custom_meshes.html">Custom Meshes</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/scene/shape/shape.html">Shape</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/scene/3d_models.html">3D Models</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/asset/asset_manager.html">Asset Manager</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/export/save_and_load.html">Saving and Loading Nodes</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/collision/collision_and_intersection.html">Collision and Intersection</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/scene/control/level_of_detail.html">Level of Detail</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Animation, Scene</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/animation/animation.html">Animation-Old</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/cinematic/cinematics.html">Cinematics (cutscenes, fake destruction physics)</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/cinematic/motionpath.html">MotionPaths and Waypoints</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Material, Light, Shadow</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/material/how_to_use_materials.html">How to use Materials</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/material/j3m_material_files.html">.j3m Material Files</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/material/material_definitions.html">.j3md Material Definitions</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/material/materials_overview.html">.j3md Properties</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/shader/jme3_shaders.html">Shaders and JME3</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/shader/jme3_shadernodes.html">Shader Node System</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/shader/shader_video_tutorials.html">Shader Video Tutorials</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/light/light_and_shadow.html">Light and Shadow</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/texture/anisotropic_filtering.html">Anisotropic Filtering</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/system/jme3_srgbpipeline.html">Gamma Correction</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Audio, Video</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/audio/audio.html">Playing Sounds</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/audio/audio_environment_presets.html">Audio Environment Presets</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/state/screenshots.html">Capture Screenshots</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/app/state/capture_audio_video_to_a_file.html">Capture Audio/Video</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Filter, Effect</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/effect/effects_overview.html">Overview</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/effect/bloom_and_glow.html">Bloom and Glow</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/effect/particle_emitters.html">Particle Emitters</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Landscapes</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/util/sky.html">Sky</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/terrain/terrain.html">Terrain (TerraMonkey)</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/collision/terrain_collision.html">Terrain Collision</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/effect/water.html">Simple Water</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/effect/post-processor_water.html">Post-Processor Water</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Camera</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/renderer/camera.html">Camera</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/renderer/making_the_camera_follow_a_character.html">Follow a Character</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/renderer/remote-controlling_the_camera.html">Remote-Controlling</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/renderer/multiple_camera_views.html">Multiple Camera Views</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/renderer/jme3_renderbuckets.html">Render Buckets</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">User Interaction</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/input/input_handling.html">Input Handling</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/input/combo_moves.html">Combo Moves</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/input/mouse_picking.html">Mouse Picking</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../core/gui/topic_gui.html">Graphical User Interface</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Nifty GUI</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/gui/nifty_gui.html">Integration Tutorial</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/gui/nifty_gui_best_practices.html">Best Practices</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/gui/nifty_gui_scenarios.html">Scenarios</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/ui/hud.html">Head-Up Display (HUD)</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Virtual Reality</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/vr/virtualreality.html">Virtual Reality</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../core/vr/virtualrealitycontrollers.html">Virtual Reality Controllers</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../physics/physics.html">Physics</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/bullet_multithreading.html">Multi-Threaded Physics</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/collision/physics_listeners.html">Collision Detection</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/joint/hinges_and_joints.html">Hinges and Joints</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/control/walking_character.html">Walking Character</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/control/ragdoll.html">Ragdoll</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/control/vehicles.html">Vehicles</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/control/softbody.html">Softbody</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../physics/bullet_pitfalls.html">Bullet Physics Pitfalls</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Networking</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../networking/networking.html">Networking (SpiderMonkey)</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../networking/headless_server.html">Headless Server</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../networking/monkey_zone.html">Multi-Player Demo Code</a>
- </li>
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../networking/networking_video_tutorials.html">Networking Video Tutorials</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">User Contributions</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <a class="nav-link" href="../../contributions/contributions.html">User Made Utilities</a>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Shader</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/shader/shaderblow_project.html">ShaderBlow Project</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Landscapes</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/lanscapes/vegetationsystem/vegetationsystem.html">Vegetation System</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Networking</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/networking/open_game_finder.html">Open Game Finder</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Entity System</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="#es/entitysystem.adoc">The Zay-ES Entity System</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Artificial Intelligence</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/ai/recast.html">Recast Navigation</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/ai/building_recast.html">Updating and building Recast Native Bindings</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/ai/monkey_brains.html">Monkey Brains</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/ai/steer_behaviours.html">Steer Behaviours</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/ai/jme3_ai.html">jME3 Artificial Intelligence</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../contributions/gui/topic_contributions_gui.html">GUI</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/contributions.html#lemur-gui-library">Lemur - a native jME3 GUI library with scene graph tools</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/contributions.html#tonegodgui">tonegodGUI - a native jME3 GUI library</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/contributions.html#immediate-graphical-user-interface">Immediate graphical user interface</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Tools</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/tools/navigation.html">Mercator Projection Tool (Marine Navigation)</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/tools/charts.html">Visualizing Maps in JME3 (Marine Charts)</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Projects</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/projects/rise_of_mutants_project.html">Rise of Mutants Project</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../sdk/sdk.html">SDK</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Video Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">SDK Use Case Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=-OzRZscLlHY">Demo 1 (Quixote demo)</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=6-YWxD3JByE">Demo 2 (Models and Materials)</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">SDK Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=M1_0pbeyJzI">Basics</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=nL7woH40i5c">Importing Models</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=DUmgAjiNzhY">Dragging&Dropping Nodes</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=ntPAmtsQ6eM">Scene Composing</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=zgPV3W6dD4s">Terrain with Collision Shape</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=Feu3-mrpolc">Working with Materials</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=MNDiZ9YHIpM">Custom Controls</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=oZnssg8TBWQ">WebStart Deployment</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="http://www.youtube.com/watch?v=D7JM4VMKqPc">Animation and Effect TrackEditing</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Getting Started</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/update_center.html">Updating jMonkeyEngine SDK</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/troubleshooting.html">Troubleshooting</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Java Development Features</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/project_creation.html">Project Creation</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/code_editor.html">Code Editor and Palette</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/version_control.html">File Version Control</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/debugging_profiling_testing.html">Debug, Profile, Test</a>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../sdk/application_deployment.html">Application Deployment</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../../sdk/default_build_script.html">Default Build Script</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../../sdk/android.html">Android</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../../sdk/android_cheat_sheet.html">Android Cheat Sheet</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../../sdk/ios.html">iOS</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Unique Features</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../sdk/model_loader_and_viewer.html">Import, View, Convert Models</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../../sdk/asset_packs.html">Asset Packs</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/scene_explorer.html">The SceneExplorer</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/scene_composer.html">Composing a Scene</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/terrain_editor.html">Terrain Editor</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/sample_code.html">Sample Code</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/material_editing.html">Material Editing</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/font_creation.html">Creating Bitmap Fonts</a>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="https://hub.jmonkeyengine.org/t/effecttrack-and-audiotrack-editing-in-the-sdk/23378">Audio and Effect Track Editing</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="https://www.youtube.com/watch?v=D7JM4VMKqPc">Video: Effect and AudioTrack editing in jMonkeyEngine 3 sdk</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/filters.html">Post-Processor Filter Editor and Viewer</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/app/state/application_states.html">Application States</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../core/scene/control/custom_controls.html">Custom Controls</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/vehicle_creator.html">Vehicle Creator</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Advanced Usage</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/build_platform.html">Building jMonkeyEngine SDK</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/use_own_jme.html#.adoc">Using your own (modified) version of jME3 in jMonkeyEngine SDK</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/increasing_heap_memory.html">Increasing Heap Memory</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/log_files.html">Log Files</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Available external plugins</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../contributions/contributions.html">Contributions</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/neotexture.html">Neo Texture Editor for procedural textures</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="http://www.youtube.com/watch?v=yS9a9o4WzL8">Video: Mesh Tool & Physics Editor</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../../sdk/development.html">Developing plugins for jMonkeyEngine SDK</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/setup.html">Creating a plugin</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/general.html">Creating components</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/scene.html">The Main Scene</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/sceneexplorer.html">The Scene Explorer</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/projects_assets.html">Projects and Assets</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/extension_library.html">Create a library plugin from a jar file</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../../sdk/development/model_loader.html">Create a new or custom model filetype and loader</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </nav>
- </div>
- <div class="nav-panel-explore" data-panel="explore">
- <div class="context">
- <span class="title">JME</span>
- <span class="version">3.4</span>
- </div>
- <ul class="components">
- <li class="component is-current">
- <span class="title">JME</span>
- <ul class="versions">
- <li class="version">
- <a href="../../../3.8/documentation.html">3.8</a>
- </li>
- <li class="version is-current">
- <a href="../../documentation.html">3.4</a>
- </li>
- <li class="version">
- <a href="../../../3.3/documentation.html">3.3</a>
- </li>
- <li class="version">
- <a href="../../../3.2/documentation.html">3.2</a>
- </li>
- </ul>
- </li>
- <li class="component">
- <span class="title">Wiki Contribution</span>
- <ul class="versions">
- <li class="version">
- <a href="../../../../docs-wiki/3.8/wiki_contributor.html">3.8</a>
- </li>
- </ul>
- </li>
- <li class="component">
- <span class="title">Wiki UI</span>
- <ul class="versions">
- <li class="version">
- <a href="../../../../wiki-ui/index.html">master</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </aside>
- </div>
- <main class="article">
- <div class="toolbar" role="navigation">
- <button class="nav-toggle"></button>
- <nav class="breadcrumbs" aria-label="breadcrumbs">
- <ul>
- <li><a href="../../documentation.html">JME</a></li>
- <li><a href="beginner.html">Beginner Tutorials</a></li>
- <li><a href="hello_physics.html">Hello Physics</a></li>
- </ul>
- </nav>
- <div class="page-versions">
- <button class="version-menu-toggle" title="Show other versions of page">3.4</button>
- <div class="version-menu">
- <a class="version" href="../../../3.8/tutorials/beginner/hello_physics.html">3.8</a>
- <a class="version is-current" href="hello_physics.html">3.4</a>
- <a class="version" href="../../../3.3/tutorials/beginner/hello_physics.html">3.3</a>
- <a class="version" href="../../../3.2/tutorials/beginner/hello_physics.html">3.2</a>
- </div>
- </div>
- <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki/edit/v3.4/docs/modules/tutorials/pages/beginner/hello_physics.adoc">Edit this Page</a></div>
- </div>
- <div class="content">
- <article class="doc">
- <h1 class="page">jMonkeyEngine 3 Tutorial (13) - Hello Physics</h1>
- <div id="preamble">
- <div class="sectionbody">
- <div class="paragraph">
- <p>Do you remember the <a href="hello_collision.html" class="xref page">Hello Collision</a> tutorial where you made the model of a town solid and walked through it in a first-person perspective? Then you may remember that, for the simulation of physical forces, jME3 integrates the <a href="http://jbullet.advel.cz/">jBullet</a> library.</p>
- </div>
- <div class="paragraph">
- <p>Apart from making models “solid”, the most common use cases for physics in 3D games are:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p>Driving vehicles with suspensions, tyre friction, ramp jumping, drifting – Example: car racers</p>
- </li>
- <li>
- <p>Rolling and bouncing balls – Example: pong, pool billiard, bowling</p>
- </li>
- <li>
- <p>Sliding and falling boxes – Example: Breakout, Arkanoid</p>
- </li>
- <li>
- <p>Exposing objects to forces and gravity – Example: spaceships or zero-g flight</p>
- </li>
- <li>
- <p>Animating ragdolls – Example: “realistic” character simulations</p>
- </li>
- <li>
- <p>Swinging pendulums, rope bridges, flexible chains, and much more…</p>
- </li>
- </ul>
- </div>
- <div class="paragraph">
- <p>All these physical properties can be simulated in JME3. Let’s have a look at a simulation of physical forces in this example where you shoot cannon balls at a brick wall.</p>
- </div>
- <div class="imageblock text-center">
- <div class="content">
- <img src="../_images/beginner/beginner-physics.png" alt="beginner-physics.png" width="360" height="291">
- </div>
- </div>
- <div class="admonitionblock tip">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-tip" title="Tip"></i>
- </td>
- <td class="content">
- <div class="paragraph">
- <p>To use the example assets in a new jMonkeyEngine SDK project, right-click your project, select <span class="menuseq"><b class="menu">Properties</b> <i class="fa fa-angle-right caret"></i> <b class="submenu">Libraries</b> <i class="fa fa-angle-right caret"></i> <b class="menuitem">Add Library</b></span>, and add the “jme3-test-data” library.</p>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="sample-code"><a class="anchor" href="#sample-code"></a>Sample Code</h2>
- <div class="sectionbody">
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">package jme3test.helloworld;
- import com.jme3.app.SimpleApplication;
- import com.jme3.asset.TextureKey;
- import com.jme3.bullet.BulletAppState;
- import com.jme3.bullet.control.RigidBodyControl;
- import com.jme3.font.BitmapText;
- import com.jme3.input.MouseInput;
- import com.jme3.input.controls.ActionListener;
- import com.jme3.input.controls.MouseButtonTrigger;
- import com.jme3.material.Material;
- import com.jme3.math.Vector2f;
- import com.jme3.math.Vector3f;
- import com.jme3.scene.Geometry;
- import com.jme3.scene.shape.Box;
- import com.jme3.scene.shape.Sphere;
- import com.jme3.scene.shape.Sphere.TextureMode;
- import com.jme3.texture.Texture;
- import com.jme3.texture.Texture.WrapMode;
- /**
- * Example 12 - how to give objects physical properties so they bounce and fall.
- * @author base code by double1984, updated by zathras
- */
- public class HelloPhysics extends SimpleApplication {
- public static void main(String args[]) {
- HelloPhysics app = new HelloPhysics();
- app.start();
- }
- /** Prepare the Physics Application State (jBullet) */
- private BulletAppState bulletAppState;
- /** Prepare Materials */
- Material wall_mat;
- Material stone_mat;
- Material floor_mat;
- /** Prepare geometries and physical nodes for bricks and cannon balls. */
- private RigidBodyControl brick_phy;
- private static final Box box;
- private RigidBodyControl ball_phy;
- private static final Sphere sphere;
- private RigidBodyControl floor_phy;
- private static final Box floor;
- /** dimensions used for bricks and wall */
- private static final float brickLength = 0.48f;
- private static final float brickWidth = 0.24f;
- private static final float brickHeight = 0.12f;
- static {
- /** Initialize the cannon ball geometry */
- sphere = new Sphere(32, 32, 0.4f, true, false);
- sphere.setTextureMode(TextureMode.Projected);
- /** Initialize the brick geometry */
- box = new Box(brickLength, brickHeight, brickWidth);
- box.scaleTextureCoordinates(new Vector2f(1f, .5f));
- /** Initialize the floor geometry */
- floor = new Box(10f, 0.1f, 5f);
- floor.scaleTextureCoordinates(new Vector2f(3, 6));
- }
- @Override
- public void simpleInitApp() {
- /** Set up Physics Game */
- bulletAppState = new BulletAppState();
- stateManager.attach(bulletAppState);
- //bulletAppState.getPhysicsSpace().enableDebug(assetManager);
- /** Configure cam to look at scene */
- cam.setLocation(new Vector3f(0, 4f, 6f));
- cam.lookAt(new Vector3f(2, 2, 0), Vector3f.UNIT_Y);
- /** Add InputManager action: Left click triggers shooting. */
- inputManager.addMapping("shoot",
- new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
- inputManager.addListener(actionListener, "shoot");
- /** Initialize the scene, materials, and physics space */
- initMaterials();
- initWall();
- initFloor();
- initCrossHairs();
- }
- /**
- * Every time the shoot action is triggered, a new cannon ball is produced.
- * The ball is set up to fly from the camera position in the camera direction.
- */
- private ActionListener actionListener = new ActionListener() {
- public void onAction(String name, boolean keyPressed, float tpf) {
- if (name.equals("shoot") && !keyPressed) {
- makeCannonBall();
- }
- }
- };
- /** Initialize the materials used in this scene. */
- public void initMaterials() {
- wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
- key.setGenerateMips(true);
- Texture tex = assetManager.loadTexture(key);
- wall_mat.setTexture("ColorMap", tex);
- stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
- key2.setGenerateMips(true);
- Texture tex2 = assetManager.loadTexture(key2);
- stone_mat.setTexture("ColorMap", tex2);
- floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg");
- key3.setGenerateMips(true);
- Texture tex3 = assetManager.loadTexture(key3);
- tex3.setWrap(WrapMode.Repeat);
- floor_mat.setTexture("ColorMap", tex3);
- }
- /** Make a solid floor and add it to the scene. */
- public void initFloor() {
- Geometry floor_geo = new Geometry("Floor", floor);
- floor_geo.setMaterial(floor_mat);
- floor_geo.setLocalTranslation(0, -0.1f, 0);
- this.rootNode.attachChild(floor_geo);
- /* Make the floor physical with mass 0.0f! */
- floor_phy = new RigidBodyControl(0.0f);
- floor_geo.addControl(floor_phy);
- bulletAppState.getPhysicsSpace().add(floor_phy);
- }
- /** This loop builds a wall out of individual bricks. */
- public void initWall() {
- float startpt = brickLength / 4;
- float height = 0;
- for (int j = 0; j < 15; j++) {
- for (int i = 0; i < 6; i++) {
- Vector3f vt =
- new Vector3f(i * brickLength * 2 + startpt, brickHeight + height, 0);
- makeBrick(vt);
- }
- startpt = -startpt;
- height += 2 * brickHeight;
- }
- }
- /** This method creates one individual physical brick. */
- public void makeBrick(Vector3f loc) {
- /** Create a brick geometry and attach to scene graph. */
- Geometry brick_geo = new Geometry("brick", box);
- brick_geo.setMaterial(wall_mat);
- rootNode.attachChild(brick_geo);
- /** Position the brick geometry */
- brick_geo.setLocalTranslation(loc);
- /** Make brick physical with a mass > 0.0f. */
- brick_phy = new RigidBodyControl(2f);
- /** Add physical brick to physics space. */
- brick_geo.addControl(brick_phy);
- bulletAppState.getPhysicsSpace().add(brick_phy);
- }
- /** This method creates one individual physical cannon ball.
- * By default, the ball is accelerated and flies
- * from the camera position in the camera direction.*/
- public void makeCannonBall() {
- /** Create a cannon ball geometry and attach to scene graph. */
- Geometry ball_geo = new Geometry("cannon ball", sphere);
- ball_geo.setMaterial(stone_mat);
- rootNode.attachChild(ball_geo);
- /** Position the cannon ball */
- ball_geo.setLocalTranslation(cam.getLocation());
- /** Make the ball physcial with a mass > 0.0f */
- ball_phy = new RigidBodyControl(1f);
- /** Add physical ball to physics space. */
- ball_geo.addControl(ball_phy);
- bulletAppState.getPhysicsSpace().add(ball_phy);
- /** Accelerate the physcial ball to shoot it. */
- ball_phy.setLinearVelocity(cam.getDirection().mult(25));
- }
- /** A plus sign used as crosshairs to help the player with aiming.*/
- protected void initCrossHairs() {
- guiNode.detachAllChildren();
- guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
- BitmapText ch = new BitmapText(guiFont, false);
- ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
- ch.setText("+"); // fake crosshairs :)
- ch.setLocalTranslation( // center
- settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
- settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
- guiNode.attachChild(ch);
- }
- }</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>You should see a brick wall. Click to shoot cannon balls. Watch the bricks fall and bounce off one another!</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="a-basic-physics-application"><a class="anchor" href="#a-basic-physics-application"></a>A Basic Physics Application</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>In the previous tutorials, you used static Geometries (boxes, spheres, and models) that you placed in the scene. Depending on their translation, Geometries can “float” in mid-air and even overlap – they are not affected by “gravity” and have no physical mass. This tutorial shows how to add physical properties to Geometries.</p>
- </div>
- <div class="paragraph">
- <p>As always, start with a standard com.jme3.app.SimpleApplication. To activate physics, create a com.jme3.bullet.BulletAppState, and and attach it to the SimpleApplication’s AppState manager.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class HelloPhysics extends SimpleApplication {
- private BulletAppState bulletAppState;
- public void simpleInitApp() {
- bulletAppState = new BulletAppState();
- stateManager.attach(bulletAppState);
- ...
- }
- ...
- }</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>The BulletAppState gives the game access to a PhysicsSpace. The PhysicsSpace lets you use com.jme3.bullet.control.PhysicsControls that add physical properties to Nodes.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="creating-bricks-and-cannon-balls"><a class="anchor" href="#creating-bricks-and-cannon-balls"></a>Creating Bricks and Cannon Balls</h2>
- <div class="sectionbody">
- <div class="sect2">
- <h3 id="geometries"><a class="anchor" href="#geometries"></a>Geometries</h3>
- <div class="paragraph">
- <p>In this “shoot” at the wall example, you use Geometries such as cannon balls and bricks. Geometries contain meshes, such as Shapes. Let’s create and initialize some Shapes: Boxes and Spheres.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> /** Prepare geometries and physical nodes for bricks and cannon balls. */
- private static final Box box;
- private static final Sphere sphere;
- private static final Box floor;
- /** dimensions used for bricks and wall */
- private static final float brickLength = 0.48f;
- private static final float brickWidth = 0.24f;
- private static final float brickHeight = 0.12f;
- static {
- /** Initialize the cannon ball geometry */
- sphere = new Sphere(32, 32, 0.4f, true, false);
- sphere.setTextureMode(TextureMode.Projected);
- /** Initialize the brick geometry */
- box = new Box(brickLength, brickHeight, brickWidth);
- box.scaleTextureCoordinates(new Vector2f(1f, .5f));
- /** Initialize the floor geometry */
- floor = new Box(10f, 0.1f, 5f);
- floor.scaleTextureCoordinates(new Vector2f(3, 6));
- }</code></pre>
- </div>
- </div>
- </div>
- <div class="sect2">
- <h3 id="rigidbodycontrol-brick"><a class="anchor" href="#rigidbodycontrol-brick"></a>RigidBodyControl: Brick</h3>
- <div class="paragraph">
- <p>We want to create brick Geometries from those boxes. For each Geometry with physical properties, you create a RigidBodyControl.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> private RigidBodyControl brick_phy;</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>The custom <code>makeBrick(loc)</code> methods creates individual bricks at the location <code>loc</code>. A brick has the following properties:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p>It has a visible Geometry <code>brick_geo</code> (Box Shape Geometry).</p>
- </li>
- <li>
- <p>It has physical properties <code>brick_phy</code> (RigidBodyControl)</p>
- </li>
- </ul>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> public void makeBrick(Vector3f loc) {
- /** Create a brick geometry and attach to scene graph. */
- Geometry brick_geo = new Geometry("brick", box);
- brick_geo.setMaterial(wall_mat);
- rootNode.attachChild(brick_geo);
- /** Position the brick geometry */
- brick_geo.setLocalTranslation(loc);
- /** Make brick physical with a mass > 0.0f. */
- brick_phy = new RigidBodyControl(2f);
- /** Add physical brick to physics space. */
- brick_geo.addControl(brick_phy);
- bulletAppState.getPhysicsSpace().add(brick_phy);
- }</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>This code sample does the following:</p>
- </div>
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p>You create a brick Geometry brick_geo. A Geometry describes the shape and look of an object.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>brick_geo has a box shape</p>
- </li>
- <li>
- <p>brick_geo has a brick-colored material.</p>
- </li>
- </ul>
- </div>
- </li>
- <li>
- <p>You attach brick_geo to the rootNode</p>
- </li>
- <li>
- <p>You position brick_geo at <code>loc</code>.</p>
- </li>
- <li>
- <p>You create a RigidBodyControl brick_phy for brick_geo.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>brick_phy has a mass of 2f.</p>
- </li>
- <li>
- <p>You add brick_phy to brick_geo.</p>
- </li>
- <li>
- <p>You register brick_phy to the PhysicsSpace.</p>
- </li>
- </ul>
- </div>
- </li>
- </ol>
- </div>
- </div>
- <div class="sect2">
- <h3 id="rigidbodycontrol-cannonball"><a class="anchor" href="#rigidbodycontrol-cannonball"></a>RigidBodyControl: Cannonball</h3>
- <div class="paragraph">
- <p>You notice that the cannon ball is created in the same way, using the custom <code>makeCannonBall()</code> method. The cannon ball has the following properties:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p>It has a visible Geometry <code>ball_geo</code> (Sphere Shape Geometry)</p>
- </li>
- <li>
- <p>It has physical properties <code>ball_phy</code> (RigidBodyControl)</p>
- </li>
- </ul>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> /** Create a cannon ball geometry and attach to scene graph. */
- Geometry ball_geo = new Geometry("cannon ball", sphere);
- ball_geo.setMaterial(stone_mat);
- rootNode.attachChild(ball_geo);
- /** Position the cannon ball */
- ball_geo.setLocalTranslation(cam.getLocation());
- /** Make the ball physcial with a mass > 0.0f */
- ball_phy = new RigidBodyControl(1f);
- /** Add physical ball to physics space. */
- ball_geo.addControl(ball_phy);
- bulletAppState.getPhysicsSpace().add(ball_phy);
- /** Accelerate the physcial ball to shoot it. */
- ball_phy.setLinearVelocity(cam.getDirection().mult(25));</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>This code sample does the following:</p>
- </div>
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p>You create a ball Geometry ball_geo. A Geometry describes the shape and look of an object.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>ball_geo has a sphere shape</p>
- </li>
- <li>
- <p>ball_geo has a stone-colored material.</p>
- </li>
- </ul>
- </div>
- </li>
- <li>
- <p>You attach ball_geo to the rootNode</p>
- </li>
- <li>
- <p>You position ball_geo at the camera location.</p>
- </li>
- <li>
- <p>You create a RigidBodyControl ball_phy for ball_geo.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>ball_phy has a mass of 1f.</p>
- </li>
- <li>
- <p>You add ball_phy to ball_geo.</p>
- </li>
- <li>
- <p>You register ball_phy to the PhysicsSpace.</p>
- </li>
- </ul>
- </div>
- </li>
- </ol>
- </div>
- <div class="paragraph">
- <p>Since you are shooting cannon balls, the last line accelerates the ball in the direction the camera is looking, with a speed of 25f.</p>
- </div>
- </div>
- <div class="sect2">
- <h3 id="rigidbodycontrol-floor"><a class="anchor" href="#rigidbodycontrol-floor"></a>RigidBodyControl: Floor</h3>
- <div class="paragraph">
- <p>The (static) floor has one important difference compared to the (dynamic) bricks and cannonballs: <strong>Static objects have a mass of zero.</strong>
- As before, you write a custom <code>initFloor()</code> method that creates a flat box with a rock texture that you use as floor. The floor has the following properties:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p>It has a visible Geometry <code>floor_geo</code> (Box Shape Geometry)</p>
- </li>
- <li>
- <p>It has physical properties <code>floor_phy</code> (RigidBodyControl)</p>
- </li>
- </ul>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> public void initFloor() {
- Geometry floor_geo = new Geometry("Floor", floor);
- floor_geo.setMaterial(floor_mat);
- floor_geo.setLocalTranslation(0, -0.1f, 0);
- this.rootNode.attachChild(floor_geo);
- /* Make the floor physical with mass 0.0f! */
- floor_phy = new RigidBodyControl(0.0f);
- floor_geo.addControl(floor_phy);
- bulletAppState.getPhysicsSpace().add(floor_phy);
- }</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>This code sample does the following:</p>
- </div>
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p>You create a floor Geometry floor_geo. A Geometry describes the shape and look of an object.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>floor_geo has a box shape</p>
- </li>
- <li>
- <p>floor_geo has a pebble-colored material.</p>
- </li>
- </ul>
- </div>
- </li>
- <li>
- <p>You attach floor_geo to the rootNode</p>
- </li>
- <li>
- <p>You position floor_geo a bit below y=0 (to prevent overlap with other PhysicControl’ed Spatials).</p>
- </li>
- <li>
- <p>You create a RigidBodyControl floor_phy for floor_geo.</p>
- <div class="ulist">
- <ul>
- <li>
- <p>floor_phy has a mass of 0f</p>
- </li>
- <li>
- <p>You add floor_phy to floor_geo.</p>
- </li>
- <li>
- <p>You register floor_phy to the PhysicsSpace.</p>
- </li>
- </ul>
- </div>
- </li>
- </ol>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="creating-the-scene"><a class="anchor" href="#creating-the-scene"></a>Creating the Scene</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>Let’s have a quick look at the custom helper methods:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p><code>initMaterial()</code> – This method initializes all the materials we use in this demo.</p>
- </li>
- <li>
- <p><code>initWall()</code> – A double loop that generates a wall by positioning brick objects: 15 rows high with 6 bricks per row. It’s important to space the physical bricks so they do not overlap.</p>
- </li>
- <li>
- <p><code>initCrossHairs()</code> – This method simply displays a plus sign that you use as crosshairs for aiming. Note that screen elements such as crosshairs are attached to the <code>guiNode</code>, not the <code>rootNode</code>!</p>
- </li>
- <li>
- <p><code>initInputs()</code> – This method sets up the click-to-shoot action.</p>
- </li>
- </ul>
- </div>
- <div class="paragraph">
- <p>These methods are each called once from the <code>simpleInitApp()</code> method at the start of the game. As you see, you can write any number of custom methods to set up your game’s scene.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="the-cannon-ball-shooting-action"><a class="anchor" href="#the-cannon-ball-shooting-action"></a>The Cannon Ball Shooting Action</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>In the <code>initInputs()</code> method, you add an input mapping that triggers a shoot action when the left mouse button is pressed.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> private void initInputs() {
- inputManager.addMapping("shoot",
- new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
- inputManager.addListener(actionListener, "shoot");
- }</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>You define the actual action of shooting a new cannon ball as follows:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java"> private ActionListener actionListener = new ActionListener() {
- public void onAction(String name, boolean keyPressed, float tpf) {
- if (name.equals("shoot") && !keyPressed) {
- makeCannonBall();
- }
- }
- };</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>In the moment the cannonball appears in the scene, it flies off with the velocity (and in the direction) that you specified using <code>setLinearVelocity()</code> inside <code>makeCannonBall()</code>. The newly created cannon ball flies off, hits the wall, and exerts a <em>physical force</em> that impacts individual bricks.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="moving-a-physical-spatial"><a class="anchor" href="#moving-a-physical-spatial"></a>Moving a Physical Spatial</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>The location of the dynamic Spatial is controlled by its RigidBodyControl. Move the RigidBodyControl to move the Spatial. If it’s a dynamic PhysicsControl, you can use setLinearVelocity() and apply forces and torques to it. Other RigidBodyControl’led objects can push the dynamic Spatial around (like pool/billiard balls).</p>
- </div>
- <div class="paragraph">
- <p>You can make Spatials that are not dynamic: Switch the RigidBodyControl to setKinematic(true) to have it move along with its Spatial.</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p>A kinematic is unaffected by forces or gravity, which means it can float in mid-air and cannot be pushed away by dynamic “cannon” balls etc.</p>
- </li>
- <li>
- <p>A kinematic RigidBody has a mass.</p>
- </li>
- <li>
- <p>A kinematic can be moved and can exert forces on dynamic RigidBodys. This means you can use a kinematic node as a billiard cue or a remote-controlled battering ram.</p>
- </li>
- </ul>
- </div>
- <div class="paragraph">
- <p>Learn more about static versus kinematic versus dynamic in the <a href="#ROOT:jme3/advanced/physics">advanced physics doc</a>.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="exercises"><a class="anchor" href="#exercises"></a>Exercises</h2>
- <div class="sectionbody">
- <div class="sect2">
- <h3 id="exercise-1-debug-shapes"><a class="anchor" href="#exercise-1-debug-shapes"></a>Exercise 1: Debug Shapes</h3>
- <div class="paragraph">
- <p>Add the following line after the bulletAppState initialization.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">// For older versions up to JME sdk 3.0.10
- bulletAppState.getPhysicsSpace().enableDebug(assetManager);</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>or</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">// For new versions thereafter
- bulletAppState.setDebugEnabled(true);</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>Now you see the collisionShapes of the bricks and spheres, and the floor highlighted.</p>
- </div>
- </div>
- <div class="sect2">
- <h3 id="exercise-2-no-mo-static"><a class="anchor" href="#exercise-2-no-mo-static"></a>Exercise 2: No Mo' Static</h3>
- <div class="paragraph">
- <p>What happens if you give a static node, such as the floor, a mass of more than 0.0f?</p>
- </div>
- </div>
- <div class="sect2">
- <h3 id="exercise-3-behind-the-curtain"><a class="anchor" href="#exercise-3-behind-the-curtain"></a>Exercise 3: Behind the Curtain</h3>
- <div class="paragraph">
- <p>Fill your scene with walls, bricks, and cannon balls. When do you begin to see a performance impact?</p>
- </div>
- <div class="paragraph">
- <p>Popular AAA games use a clever mix of physics, animation and prerendered graphics to give you the illusion of a real, “physical” world. Think of your favorite video games and try to spot where and how the game designers trick you into believing that the whole scene is physical. For example, think of a building “breaking” into 4-8 parts after an explosion. The pieces most likely fly on predefined (so called kinematic) paths and are only replaced by dynamic Spatials after they touch the ground… Now that you start to implement game physics yourself, look behind the curtain!</p>
- </div>
- <div class="paragraph">
- <p>Using physics everywhere in a game sounds like a cool idea, but it is easily overused. Although the physics nodes are put to “sleep” when they are not moving, creating a world solely out of dynamic physics nodes will quickly bring you to the limits of your computer’s capabilities.</p>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="conclusion"><a class="anchor" href="#conclusion"></a>Conclusion</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>You have learned how to activate the jBullet PhysicsSpace in an application by adding a <code>BulletAppState</code>. You have created PhysicsControls for simple Shape-based Geometries (for more complex shapes, read up on <a href="../../physics/physics.html" class="xref page">CollisionShapes</a>). You have learned that physical objects are not only attached to the rootNode, but also registered to the PhysicsSpace. You know that it makes a difference whether a physical object has a mass (dynamic) or not (static). You are aware that overusing physics has a huge performance impact.</p>
- </div>
- <div class="admonitionblock tip">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-tip" title="Tip"></i>
- </td>
- <td class="content">
- <div class="paragraph">
- <p>Congratulations! – You have completed the last beginner tutorial. Now you are ready to start combining what you have learned, to create a cool 3D game of your own. Show us what you can do, and feel free to share your demos, game videos, and screenshots on the <a href="http://hub.jmonkeyengine.org/c/user-code-projects">User Code & Projects Forum</a>!</p>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <nav class="pagination">
- <span class="prev"><a href="hello_effects.html">Hello Effects</a></span>
- <span class="next"><a href="../concepts/best_practices.html">Best Practices</a></span>
- </nav>
- </article>
- <aside class="toc sidebar" data-title="Contents" data-levels="2">
- <div class="toc-menu"></div>
- </aside>
- </div>
- </main>
- </div>
- <footer class="footer">
- <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
- </footer>
- <script src="../../../../_/js/vendor/docsearch.min.js"></script>
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
- <script>
- var search = docsearch({
- apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
- indexName: 'jmonkeyengine',
- inputSelector: '#search-input',
- autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
- algoliaOptions: { hitsPerPage: 10 }
- }).autocomplete
- search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
- function focusSearchInput () { document.querySelector('#search-input').focus() }
- if (document.querySelector('.home-link.is-current')) window.addEventListener('load', focusSearchInput)
- </script>
- <script src="../../../../_/js/site.js"></script>
- <script async src="../../../../_/js/vendor/highlight.js"></script>
- </body>
- </html>
|