Jump to content

Search the Community

Showing results for tags 'node rotation;'.

  • 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 1 result

  1. Hi all. While coding I came up with an issue involving incorrect node rotation which, for the life of me, I'm not able to figure out. If would be helpful if someone could point out where the issue is. Basically I'm trying to create and align a shell along the barrel of an artillery. The final line of world transformation is incorrectly rotating the shell. Kindly find pics attached. Code for spawning and aligning shell is like this : void spawnShell() { // Create shell node. m_cRefNode = class_remove( new NodeReference( "nodes/weapons/ammunition/155mm_shell.node" ) ); engine.editor.addNode( m_cRefNode ); assert( m_cRefNode != NULL ); m_cRefNode.setName( "he_shell" ); m_cRefNode.setProperty( "HEShell" ); // Find and assign necessary nodes. Node container = m_cRefNode.getNode(); m_cObject = node_cast( container ); int id = container.findChild( "nose" ); m_cNoseNode = node_cast( container.getChild( id ) ); id = container.findChild( "base" ); m_cBaseNode = node_cast( container.getChild( id ) ); assert( m_cObject != NULL ); assert( m_cBaseNode != NULL ); assert( m_cNoseNode != NULL ); // Place and align the shell w.r.t artillery barrel NodeDummy barrelEnd = m_cOwnerArtillery.getBarrelEnd(); m_cRefNode.setWorldPosition( barrelEnd.getWorldPosition() ); // Rot_Issue_2/2A.jpg m_cRefNode.setWorldRotation( m_cOwnerArtillery.getWorldRotation() ); // Rot_Issue_3/4.jpg vec3 v1 = m_cNoseNode.getWorldPosition() - m_cBaseNode.getWorldPosition(); vec3 v2 = m_cOwnerArtillery.getLaunchDirection(); if( v1 != v2 && length( v1 ) != 0.0f && length( v2 ) != 0.0f ) { v1 = normalize( v1 ); v2 = normalize( v2 ); vec3 v3 = cross( v1, v2 ); v3 = normalize( v3 ); float angle = acos( dot( v1, v2 ) ) * RAD2DEG; m_cRefNode.setWorldTransform( m_cRefNode.getWorldTransform() * rotate( v3, angle ) ); // Rot_Issue_5/5A.jpg } } rotation_issue.rar
×
×
  • Create New...