Crystal Space
Welcome, Guest. Please login or register.
October 30, 2014, 01:25:27 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8880 Members
Latest Member: Wepelczyn
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  Orientation borked when using CelEntity template to import an Entity
« previous next »
Pages: [1] Print
Author Topic: Orientation borked when using CelEntity template to import an Entity  (Read 2544 times)
nev7n
Newbie
*
Posts: 6


View Profile Email
« on: January 13, 2009, 05:03:25 pm »

I'm trying to spawn an npc at a point in my world.  I have the world in one blender file and the npc in a second.  I've looked at crystalcore to see how that achieves the same thing but I'm having trouble getting the imported mesh orientated correctly.

A few pictures to illustrate the problem:-




and the code I'm using to set up the spawn point:

Code:
<!--
  - This library contains an entity template for a spawn point that spawns npcs.
  -->
<library>
    <addon plugin="cel.addons.celentitytpl" entityname="npc-spawnpoint" >
        <propclass name="pclogic.spawn">
    <action name="AddEntityTemplateType">
    <par name="chance" float="1.0" />
    <par name="template" string="$template" />
    <par name="entity" string="$entname" />
    </action>
    <action name="SetTiming">
    <par name="repeat" bool="true" />
    <par name="random" bool="true" />
    <par name="mindelay" long="1000" />
    <par name="maxdelay" long="1000" />
    </action>
    <action name="SetEnabled">
    <par name="enabled" bool="true" />
    </action>
    <action name="AddSpawnPosition">
    <par name="sector" string="$sector" />
    <par name="position" string="$node" />
                <par name="yrot" float="0.0" />
    </action>
    <property name="namecounter" bool="false" />
    <property name="spawnunique" bool="true" />
    <action name="Spawn" />
</propclass>
    </addon>
</library>


Code:
<?xml version="1.0" encoding="UTF-8"?>
<library>
  <library path="/models/npc_test" file="library" />
  <addon plugin="cel.addons.celentitytpl" entityname="npc_test-tpl">
    <propclass name="pcmesh" tag="model">
      <action name="LoadMesh">
    <par name="factoryname" string="body" />
  </action>
  <action name="MoveMesh">
    <par name="sector" string="$sector" />
            <par name="position" vector="$pos" />
  </action>
    </propclass>
    <propclass name="pcobject.mesh.select" />
    <behaviour layer="behaviourlayer" name="npc_behave" />
  </addon>
</library>

Finally my entities file for my world:
Code:
<world>
  <library file="/library/npc_spawnpoint.xml" />
  <library file="npc_test.xml" path="/npc_test" />
  <library file="viewControls.xml" path="/entities/viewControls" />

    <addon plugin="cel.addons.celentity" template="npc-spawnpoint" entityname="npc1-spawnpoint" >
      <params>
        <par name="template" value="npc_test-tpl" />
        <par name="entname" value="npc1" />
<par name="sector" value="Scene" />
<par name="node" value="npc_test" />
      </params>
    </addon>
</world>

I've tried rotating the empty node in blender but that makes no difference.  I've seen the yrot parameter in AddSpawnPosition but for some reason my model is misaligned in more than one axis.  I don't understand why my mesh is being rotated?

Nev7n.
Logged
nev7n
Newbie
*
Posts: 6


View Profile Email
« Reply #1 on: January 15, 2009, 05:37:21 pm »

Thanks to caedes on irc for solving this for me.  It turns out the local axes of my armature were rotated relative to the global axes.

nev7n.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.188 seconds with 16 queries.