Hi there,
I have a problem that makes me crazy!! I just want to move a entity in my celstart app (written in xml) and don't get it to move! I use the physic layer (pcmechobject) for my entity. Its no problem to give duration on my model with the pcmechobject propertyclass, but setting the position to fix coords (i.e. 0,0,0) seems impossible.
Here a minimal example of my problem:
<addon plugin="cel.addons.celentity" entityname="camera">
<propclass name="pcmechsys">
<action name="QuickStep" />
<action name="SetStepTime">
<par name="time" float="0.02" />
</action>
</propclass>
<propclass name="pccommandinput">
.
.
.
</propclass>
<propclass name="pcdefaultcamera">
<action name="SetCamera">
<par name="modename" string="freelook" />
<par name="spring" vector="3.5,0.25,0.01" />
<par name="distance" vector="2,8,16" />
<par name="fpoffset" vector="0,1,0" />
<par name="tpoffset" vector="0,1,3" />
</action>
</propclass>
<propclass name="pcmesh">
<action name="LoadMesh">
<par name="factoryname" string="hamster" />
</action>
<action name="MoveMesh">
<par name="sector" string="room" />
<par name="position" vector="0,2,0" />
</action>
</propclass>
<propclass name="pcmechobject">
<action name="SetColliderMesh">
<par name="factoryname" string="hamster" />
<par name="offset" vector="0.0,0.0,0.0" />
</action>
</propclass>
<behaviour name="shooter" />
<call event="init" />
</addon>
<addon plugin="cel.addons.xmlscripts">
<script name="shooter">
<event name="init">
<var name="pcmesh" value="pc(pcmesh)" />
<var name="pcmech" value="pc(pcmechobject)" />
</event>
.
.
.
<event name="shootEm">
<call event="calcShoot" /> <!-- Here x, y and z are calculated -->
<default propclass="?pcmech" />
<expr eval="AddForceDuration{force=[?x,?y,?z],relative=false,position=[-0.00000001,0,0.0000001],seconds=.2}" />
</event>
<event name="pccommandinput_restart1">
<default propclass="?pcmesh" />
<expr eval="MoveMesh{sector='room',position=[0,0,0]}" />
</event>
</script>
</addon>
Here is the runable celzip of my project (5,3MB):
http://knecht.homelinux.net/ftp/ftp2/knecht/hamsterRev.celzipshoot the hamster with space, reset the scene with left CTRL (it does not change position back, that is my problem), and control the durationForce with cursorkeys (up,down = power, left/right=direction, w/s keys for the angle)
To run AddForceDuration on pcmechobject works, but there is no MoveMesh or SetPosition in that property class. I tried to work with
pcmesh and
MoveMesh (see my code), i tried to use pcmove.linear with SetPosition (there is no documentation, i tried to read the parameter names from cel api documentation) or MoveMesh, and tried a few other things, but my modell is not moving!! There are no errors on console, but also no effect in my game.
The game is to shoot a hamster out of a cage, and i want to reset the hamster to startposition, but i don't know how!
How can i just set the position of my model to an absolut position?
It seems that this post is about an similar problem:
http://www.crystalspace3d.org/forum/index.php/topic,906.msg4286.html#msg4286I also ask in the irc chat (#crystalspace) and search for an solution. All they told me is: "use pcmechobject, use pcmesh, use pcmove.linear", but i can't figure it out. Has someone ever moved an entity from xml behaviour scripts? If yes, HOW? AddForceDuration is no problem and works, but to set the position i found no documentation and no examples.
Any suggestions ?
Thanks
Sebastian