One very common action to perform in 3D games is to dynamically add weapons and details to a mesh. This recipe shows the process of loading a sword and binding it to the walker model's wrist.
Create a new project, add the walker.mdx
model, and set its Build Action to Content. Be sure to add a reference to the Sce.PlayStation.HighLevel.Model
library. I modeled an extremely simple sword mesh in Blender and exported it to MDX as sword.mdx
. Add it to your project and again set its Build Action to Content. It is available with the source code as Ch8_Example7
.
Once again this code shares a great deal with earlier recipes. Open AppMain.cs
and change Main
to match the following code (bolded area represents changes):
public static void Main (string[] args) { var graphics = new GraphicsContext (); graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f); var model = new BasicModel("/Application/walker.mdx",0); var sword ...