Cannot create an instance of physicscanvas

Nov 1, 2012 at 2:38 PM


I have just started with physics helper and I followed the steps as per mentions in the documentation.

I added the following in xaml

"<Canvas x:Name="cnvGameOuter"  >

    <ph:PhysicsCanvas x:Name="cnvGame" Background="Blue"  Width="1366" Height="768" MousePickEnabled="true">

        <ph:PhysicsSprite x:Name="block" Canvas.Left="200" Canvas.Top="0"  Width="100" Height="100" >
            <Rectangle Width="100" Height="100" Fill="Red" />
        </ph:PhysicsSprite>

        <ph:PhysicsSprite x:Name="ground" Background="DarkGreen"  Canvas.Left="0" Canvas.Top="648"  Width="1366" Height="120" IsStatic="True" />

    </ph:PhysicsCanvas>

</Canvas>"

 

its giving me an error as cannot create an instance on PhysicsCanvas. What is the solution for it??

Coordinator
Nov 1, 2012 at 10:18 PM
Edited Nov 1, 2012 at 10:19 PM

It looks like you are using the newer (Windows 8, WP) version of Physics Helper XAML from here - http://physicshelperxaml.codeplex.com/

This forum is for the original Physics Helper which uses Behaviors.

At any rate, you should make sure that you have an xmlns at the top of the xaml, like this:

xmlns:ph="using:Spritehand.FarseerHelper"