dim3 Forum

Full Version: Movement Troubles.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have been trying to make a hangar, with a "Control Room" Which opens the hangar door, so you can fly the ships out. In the control room I have a switch, based from the demo switch, which opens the door with a movment. I have two problems with this.

1. The switch is only clickable from the back and sides, not the front.

2. The door does not open. I am getting no errors. Here is the script and screenshots of my settings:

Code:
// ***********************************************************
//
// OBJECT: Switch Move
//
// A simple switch that can be used to move segments from one
// point to another.  It takes one parameter:
//
// parameter 0: map movement to activate
//
// ***********************************************************

var switchUp;

//
// switch construction
//

function switchConstruct(obj)
{
    obj.model.on=true;
    obj.model.name="Switch";
    
    obj.setting.suspend=true;
    obj.model.light.on=false;
    obj.model.halo.on=false;
    obj.model.shadow.on=false;
    obj.setting.damage=false;
    obj.setting.invincible=true;
    obj.setting.clickable=true;
    obj.size.clickDistance=4500;

    obj.size.x=500;
    obj.size.z=600;
    obj.size.y=1000;
    
    switchUp=true;             // switch starts in the up position
}

//
// switch clicking
//

function switchClick(obj)
{
        // can't click switch again until move is over
        
    obj.setting.clickable=false;
    
        // change switch position
        
    if (switchUp) {
        obj.model.animation.start('SwitchDown');
        map.movement.start(obj.setting.getParameter(0));
        switchUp=false;
    }
    else {
        obj.model.animation.start('SwitchUp');
        map.movement.startReverse(obj.setting.getParameter(0));
        switchUp=true;
    }
}

//
// swich move events
//

function switchMove(obj,subEvent,id)
{
        // the LOOP event is sent when a movement
        // is ready to loop (or stop if not looping)
        // we use this to determine if it's OK to activate
        // the switch again
    
    if (subEvent==DIM3_EVENT_MOVE_LOOP) {
        obj.setting.clickable=true;
    }
}

//
// switch events
//

function event(obj,mainEvent,subEvent,id,tick)
{
    switch (mainEvent) {
    
        case DIM3_EVENT_CONSTRUCT:
            switchConstruct(obj);
            return;
    
        case DIM3_EVENT_CLICK:
            switchClick(obj);
            return;
            
        case DIM3_EVENT_MOVE:
            switchMove(obj,subEvent,id);
            return;
            
    }
}

[Image: picture4fr4.png]
http://img292.imageshack.us/img292/3875/picture4fr4.png
[Image: picture3pp3.png]
http://img384.imageshack.us/img384/2791/picture3pp3.png
[Image: picture2hn3.png]
http://img501.imageshack.us/img501/7982/picture2hn3.png
[Image: picture1zu6.png]
http://img511.imageshack.us/img511/2258/picture1zu6.png

It would be awesome if you could help.
I bet this is the same problem -- I really need to put up an error when this happens so it's easier to debug -- the mesh that you are moving needs to have the "moveable" flag set on it.

(The reason for this, as an aside since nobody has really asked Smile, is because it allows me to separate the map into sections that never move and can be cached versus sections that could be different from tick to tick.)

[>] Brian
I do, look in the bottom right of the following picture. Or is it something else?

http://img511.imageshack.us/img511/2258/picture1zu6.png
Typewriter Wrote:I do, look in the bottom right of the following picture. Or is it something else?

http://img511.imageshack.us/img511/2258/picture1zu6.png

Oops, sorry, my bad -- that's just so often the problem that I jump to that Smile Can you send me your project?

[>] Brian
Okay, i'll get the level here soonish. I'll edit this post. Thanks for helping.

http://www.2shared.com/file/3403899/3529..._Need.html

You should be able to work out where everything goes, I hope.
*Bump*

Sorry but I can't really get anything done on my project until this is fixed, can anyone tell me whats wrong?
Sorry, it's taken me a while to look at this. When I look at your map, there doesn't seem to be any meshes/segments associated with the group. If you pull down the group menu, there will be a (X) next to the group, that's the number of things hooked up to it. If it's zero, then there's nothing to move. You need to select the segment, then pick the group. When it says (1) then you know you've done it.

In the new version, you map display the floaty physics problem that I've been looking for a good example of, so it's also good for me to test that!

[>] Brian
Along this same line, for the new mesh version, I check and put up console errors for:

1) starting a move with negative time (hard but you can do it)
2) starting a move on a group with no meshes/liquids attached to it
3) starting a move on mesh in a group without the moveable flag set

Hopefully what I wrote on the message above is the answer, and if it is, I need to have better error handling to catch these problems.

[>] Brian
Hmm, moving liquids? Would be useful for "floods" Never thought of that. But thanks for helping, and i'm glad it helps you test. It does have a few ladders doesn't it =P.
Reference URL's