About Store Forum Documentation Contact



Post Reply 
Jumping through object
Author Message
koekwaus Offline
Member

Post: #1
Jumping through object
Hi,

Currently i'm working on a side scroller which is going great. But i have a little problem and i like to discuss what the best way is to do this.

I have this controller class that represents the player. Now i have in world editor set up bunch of platforms that the player is able to jump on. But the player must to be able to jump though the platform (from below to on top). So for each platform i have struct that extends a game::obj and an actor as member. So i want to combine all actors (of the platforms) to 1 single actor so that i can use the ignore functionality in the actor of the controller.

But i'm wondering if this is the correct way to do this?
Even so, i'm not sure yet how to do this.

Thanks,
03-02-2012 03:59 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #2
RE: Jumping through object
Hello There and welcome.
I think there is no point ignoring the platforms by the player.
If you ignore the actors they become totally useless. they will not hold you on top of them either.
What you could do is use a plane as a physics object. This way it only reacts from one side.
03-02-2012 07:31 PM
Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #3
RE: Jumping through object
Thanks! I will look at that. But the player must also be able to jump from the top to below the platform (actually falling through). I'm sorry, I forgot to mention that.

Edit: I've looked at planes but is there anyway that i can define a size? it looks like a plane goes infinity
(This post was last modified: 03-03-2012 04:02 PM by koekwaus.)
03-03-2012 03:40 PM
Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #4
RE: Jumping through object
(03-03-2012 04:09 PM)aceio76 Wrote:  Maybe separate the platform physics, then move/remove/hide the platform physics when jump is invoked? Maybe time the deactivation of the physics platform to a short time so that the player does not fall thru multiple platforms in one jump? Or maybe instead of working with the platform physics, work with the player physics instead, where you deactivate it (whatever means) when jump is invoked, but again only for a short time so the player doesn't go thru multiple platforms at a time?

That was sort of my idea, I wanted combine all platform actors in one actor because a actor can ignore a other actor, but it can only ignore one actor. So when the velocity of the controller is positive (means he is jumping) the platform actor will be ignored. The falling though a actor is sort of same idea, but need to find a way to reset it. Maybe a timer will do the job.
03-03-2012 04:49 PM
Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #5
RE: Jumping through object
Ok, I'm getting this error:

Quote:Can't create actor:
Actor::create(ActorShapes &shapes, Flt density, Bool, kinematic);
density = 1.000
kinematic = 0
Actor Shapes: 7 / 65536

What I got:
Platform.h:
Code:
STRUCT(Platform, Game::Obj)
//{

    static ActorShapes shapes;
    static Actor    ptfmActor;
    static Actor*    getActor();

    virtual    void    create(Game::ObjParams &obj_params);

    virtual Vec        pos   (                ) {    return position; }
    virtual void    pos   (C Vec    &pos   ) {    position = pos; }

    virtual Matrix    matrix(                ) { return position           ;} // get matrix
    virtual void    matrix(C Matrix &matrix) {  position = matrix.pos;} // set matrix

    virtual Bool    update();
    virtual UInt    drawPrepare();
    virtual void    drawShadow();
    void            drawActor();

    private:
    Vec            position;
    MeshPtr        mesh;
    PhysBody    pbody;
    Actor        actor;
};

Platform.cpp:
Code:
#include "stdafx.h"
#include "Platform.h"

ActorShapes Platform::shapes;
Actor        Platform::ptfmActor;

Actor* Platform::getActor()
{
    ptfmActor.create(shapes);
    return &ptfmActor;
}

void Platform::create(Game::ObjParams &obj_params)
{
    position    = obj_params.matrixFinal().pos;
    mesh        = obj_params.mesh();

    mesh->scale(obj_params.scale());
    pbody.parts.New().createMesh(*mesh);
    
    shapes.add(pbody);
    
}

What i'm doing wrong?
(This post was last modified: 03-05-2012 04:08 PM by koekwaus.)
03-05-2012 02:37 PM
Find all posts by this user Quote this message in a reply
Post Reply