Version v0.41.5+ of the editor supports simpler shader creation. To register (or duplicate / modify) a shader, in the editor click on Assets -> Shaders -> Pick / Add Shader. For more details see here.
The key components are; TiledNavMeshComponent, NavMeshCrowdComponent, NavMeshObstacle and NavMeshAgent. As can be seen from the video in the editor you can now import models then generate navigable areas for agents to move around. Within the editor you can then wire up input devices to scripts that then perform ray -> mesh intersection to move your agents. The entire scene (models, nav mesh, agents, scripts and input handling) can then be saved to file or published as a code project from within the editor. A typical script (that is saved into the scene file) is included below. You would typically trigger this script in response to an event (i.e. an input device event – by adding a Mouse input device to the scene and wiring up its onMouseButtonDown event to the script’s execute method or in response to an object entering a collision volume. (see the collision volume support in the video log).
require('fireflyscript') require('ext_NavigationScript') -- find the agent, nav mesh and crowd scene = sdk:GetScene() agent = scene:Find('Agent') navMesh = scene:Find('NavMesh') agentComponent = ext_NavigationScript.GetComponent_Navigation_NavMeshAgentComponent(agent) crowdComponent = ext_NavigationScript.GetComponent_Navigation_NavMeshCrowdComponent(navMesh) navMeshComponent = ext_NavigationScript.GetComponent_Navigation_TiledNavMeshComponent(navMesh) -- unproject the current mouse pos at both near / far clip planes mousePos = sdk:GetMousePosition() pickRayNear = fireflyscript.vec3() pickRayFar = fireflyscript.vec3() sdk:UnprojectNearFar(mousePos:GetX(), mousePos:GetY(), pickRayNear, pickRayFar) -- obtain navigation mesh transform navMesh = fireflyscript.CastSceneItemToPickableSceneItem(navMesh) worldToLocal = navMesh:GetWorldMatrixInverse() localToWorld = navMesh:GetWorldMatrix() -- test pick ray against nav mesh geometry geom = navMeshComponent:GetMesh() localPickRayNear = worldToLocal * fireflyscript.vec4(pickRayNear, 1) localPickRayFar = worldToLocal * fireflyscript.vec4(pickRayFar, 1) localIntersectionPoint = fireflyscript.vec3() geom:LineTest(fireflyscript.vec3(localPickRayNear), fireflyscript.vec3(localPickRayFar), localIntersectionPoint) -- move the agent(s) crowdComponent:SetTargetPoint(fireflyscript.vec3(localToWorld * fireflyscript.vec4(localIntersectionPoint,1)))
The copy and swap idiom is becoming a popular question in C++ interviews to explore a candidate’s understanding of modern C++. I put together a small github repo / example with references to demonstrate the principle here.
In this modern age of dockerized apps there are still times when it’s desirable to bundle an app, its dependencies and resources as a self contained installable bundle on Linux.
I wanted to start using the AWS SDK from a native app with the least amount of friction to simplify porting it to other platforms and thought about sharing the approach in case it’s of use to others.
There are a few forms a C/C++ library that you want to cross compile to Android might come in.
- An Autotools project
- A CMake project
To get started let’s make a standalone Android toolchain (a toolchain being compilers, libraries and headers for cross compiling our source code to a specific target architecture and platform ABI) . Continue reading Cross compiling C/C++ libraries for Android (updated)