Game Development Community

Mount issues

by Helk · in iTorque 2D · 05/19/2009 (2:07 pm) · 28 replies

Hi guys, I'm experiencing an issue with mounting.

When I mount an object to another, and move the parent object there is a 1 frame delay before the mounted object moves.. it's almost like it's interpolating behind the parent object and this is very noticable with lower framerates.. Any ideas? Thanks
Page «Previous 1 2
#1
05/20/2009 (1:36 am)
Make sure the child objects all have "setUsesPhysics()" enabled.
#2
05/26/2009 (7:04 pm)
No, this happens when running on the mac, I tried adding setusesphysics as well, no change.. try it yourself.. mount something to something else, perhaps attach the parent to the cursor and move it.. you will see the mounted objects interpolate behind the parent
#3
05/26/2009 (7:13 pm)
make sure you use a mount for of 0 which signifies rigid mounting.
#4
05/26/2009 (7:16 pm)
Sorry I don't understand what you mean by 'a mount for of 0' can you clarify please?
#5
05/26/2009 (7:34 pm)
0 is the mount force. Its a parameter in the mount function.

mount(%object, [%offsetX, %offsetY, [%force, [%trackRotation, [%sendToMount, [%ownedByMount, [%inheritAttributes]]]]]])

You only need to specify the first 3 if you want. myObj.mount(obj, 0, 0, 0);

Thats a rigid mount force with no offset.
#6
05/26/2009 (7:37 pm)
I'm doing this from the editor, and it says it's '0.000'
#7
05/26/2009 (7:42 pm)
Then it should be fine..

What I am doing is having the camera mounted to the player along with my UI objects so when the player moves the camera/ui object move with him. It works great. And I so have setUsesPhysics(true) on every ui object.
#8
05/26/2009 (7:56 pm)
I'm also using mounting extensively and have setusesphysics set on everything and it's all working great. I hate the "coordinate" system of mounting but that's about it.
#9
05/26/2009 (8:03 pm)
Am I crazy?

Unknown command setUsesPhysics.

Object VerticalDrillHead(1350) VerticalDrillHead -> t2dAnimatedSprite -> t2dSceneObject -> BehaviorComponent -> DynamicConsoleMethodComponent -> SimComponent -> SimObject
#10
05/26/2009 (8:06 pm)
You get that if your not building with PUAP_OPTIMIZE, which the TGBGame for Mac/Windows both don't have defined by default
#11
05/26/2009 (8:12 pm)
Well I'm only testing on the Mac right now not on device so what gives?
#12
05/26/2009 (8:31 pm)
I get unknown command to actually as well. As bret said the TGB game doesn't know the command with the target it was built with.

In game tho both mac and iPhone the mounting works fine (its rigid for me, no delay)

Check everything you mounted and make sure its correct.
#13
05/26/2009 (8:32 pm)
Are you doing it from the editor or code?

I didnt change anything and the mount force is 0 by default in the editor so I don't know what else I could be doing wrong..
#14
05/26/2009 (8:36 pm)
I tried calling setMountForce(0); on the objects and there's no change.. I'm using 2 t2dSceneObjects btw, Also I really appreciate all the help you guys are giving me, I was about to write my own system to handle mounting.
#15
05/26/2009 (9:19 pm)
in code I do something like this...

function fourwayController::onLevelLoaded(%this, %scenegraph)
{
   %this.setUsesPhysics(true);
   %this.mount($marine, -4.5, 2.5, 0);
}

my four way controller is a gui object which is really just a scene object (static sprite actually)

It mounts it to the my player objects, $marine.

SceneWindow2D is mounted to my player object too.

function MarinePlayer::onLevelLoaded(%this, %scenegraph)
{
   %this.setUsesPhysics(true);
   $marine = %this;
   
   sceneWindow2D.mount(%this, 0, 0, 0);
}

I am basically mounting everything to my marine guy, the one that moves.

Hope this helps
#16
05/27/2009 (12:40 pm)
I've tired all that and it seems like the only problem is when I call setPosition() on the parent object.. using linear velocities it's a rigid mount, but setPosition has an interpolation lag...
#17
05/27/2009 (12:43 pm)
Also, if I call setPosition on all the children objects with appropriate offsets then it works perfectly.. but that bypasses the entire point of mounting.. so I'm not sure what to do
#18
05/27/2009 (2:01 pm)
I don't believe I've tried calling setPosition on a mounted objects parent before. It's possible there is a bug or lag in that scenario.
#19
05/27/2009 (7:24 pm)
Can someone else try this for me please? It's causing a lot of problems for me... Thanks so much
#20
05/30/2009 (1:21 pm)
Logged for v1.2.x
Page «Previous 1 2