Jump to content

Search the Community

Showing results for tags 'addForce'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. Hello! I apply force to the PlayerActor so that it moves horizontally. Logically, it should be uniformly accelerated (using gravity as an example), but its speed will fluctuate from 1.2-2. It seems as if something is stopping him from accelerating. In the vertical plane, everything works correctly. I use addForce() in the flush() function. And if I’m doing exactly the same but applying force to the created figures in maps, then everything works correctly. This effect is only in PlayerActor. PlayerActorPtr actor = PlayerActor::cast(Game::get()->getPlayer()); if (actor) { BodyRigidPtr obj = BodyRigid::cast(actor->getBody()); if (obj) { obj->addForce(obj->getCenterOfMass(), Math::vec3(0, 9.81f*obj->getMass(), 0)); } }
  2. i want use addForce() in flush() but is nothing happened #include <unigine.h> ObjectMesh mesh; BodyRigid bd; int jmp=false; Node addND(Node nd) { //node_remove(nd); nd.setName("abcd"); engine.editor.addNode(class_remove(nd)); log.message("add %s","==============================================="); return nd; //return node_remove(nd); } PlayerActor camera; ControlsDummy mycon=new ControlsDummy(); int init() { camera = new PlayerActor(); //Player camera=new PlayerDummy(); camera.setPosition(Vec3(0.0f,0.0f,2.5f)); camera.setDirection(Vec3(-1.0f,0.0f,-0.5f)); engine.game.setPlayer(camera); engine.controls.setStateKey(CONTROLS_STATE_JUMP,'f'); if(engine.editor.findNode("abcd")== -1){ log.message("NULL %s","========\r\n"); mesh=addND(new ObjectMesh("my_project/meshes/box.mesh")); mesh.setMaterial("mesh_noise_base","*"); mesh.setProperty("surface_base","*"); } else{ log.message("NOT NULL %s","========"); } Node dd= engine.editor.getNode(engine.editor.findNode("abcd")); Object ob=class_cast("Object",dd); bd=class_cast("BodyRigid",ob.getBody()); engine.controls.setKeyReleaseCallback("butt_ress"); return 1; } int shutdown() { return 1; } int update() { return 1; } int butt_ress(int button) { if(button==32) {//space log.message("body...... %s\n","space"); jmp=true; } return 0; } int xxcou=0; int flush() { if(jmp) { if(xxcou>1){ xxcou=0; jmp=false; } bd.setLinearDamping(0); bd.addForce(bd.getCenterOfMass(),vec3(0.0f,0.0f,10)); /* why this is noting happened */ xxcou++; log.message("flush...... %s\n","========================"); } return 1; }
×
×
  • Create New...