|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Problems with entity movementHello,
I've recently been playing with mangalore, trying to make an entity to move on screen to the left and right. I've created a PlayerInputProperty class, which should send MoveDirection message to it's entity (and other properties), thus ordering them to move to desired direction (left/right). But no matter what I do, my entity keeps moving down only. I've tried to change y and z coords of direction vector (look at the code), but no use - my player entity goes only down. I would be very grateful if someone has any ideas where the problem may be. The blueprint of Player entity is like this: --- <!-- a player entity --> <Entity type="Player" cppclass="Entity"> <Property type="ActorGraphicsProperty" /> <Property type="ActorPhysicsProperty" /> <Property type="ActorAnimationProperty" /> <Property type="PlayerInputProperty" /> </Entity> --- Here's some code of mine: --- void PlayerInputProperty::OnBeginFra me()
{ // only do something if we have the input focus if(Managers::FocusManager::Instance()->GetInputFocusEntity() == this->GetEntity()) { Input::Server *inputServer = Input::Server::Instance(); // get the direction in which we're moving. float left = inputServer->GetSlider("mouseLeft"); float right = inputServer->GetSlider("mouseRight"); vector3 direction( 0.0f, 0.0f, 0.0f); if(left > 0.0f) { direction.x = -1.0f; SendMoveDirection(direction); } if(right > 0.0f) { direction.x = 1.0f; SendMoveDirection(direction); } //if(right == 0.0f && left == 0.0f) // this->SendMoveStop(); } InputProperty::OnBeginFrame(); } void PlayerInputProperty::SendMoveDirection(vector3 dir) { Ptr<Message::MoveDirection> msgDir = Message::MoveDirection::Create(); msgDir->SetDirection(dir); this->GetEntity()->SendAsync(msgDir); } --- ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementJulius Seporaitis wrote:
> Hello, > > I've recently been playing with mangalore, trying to make an entity to > move on screen to the left and right. I've created a PlayerInputProperty > class, which should send MoveDirection message to it's entity (and other > properties), thus ordering them to move to desired direction > (left/right). But no matter what I do, my entity keeps moving down only. > > I've tried to change y and z coords of direction vector (look at the > code), but no use - my player entity goes only down. > > I would be very grateful if someone has any ideas where the problem may be. > > The blueprint of Player entity is like this: > > --- > <!-- a player entity --> > <Entity type="Player" cppclass="Entity"> > <Property type="ActorGraphicsProperty" /> > <Property type="ActorPhysicsProperty" /> > <Property type="ActorAnimationProperty" /> > <Property type="PlayerInputProperty" /> > </Entity> > --- > > Here's some code of mine: > > --- > void > PlayerInputProperty::OnBeginFra > me() > { > // only do something if we have the input focus > if(Managers::FocusManager::Instance()->GetInputFocusEntity() == > this->GetEntity()) > { > Input::Server *inputServer = Input::Server::Instance(); > > // get the direction in which we're moving. > float left = inputServer->GetSlider("mouseLeft"); > float right = inputServer->GetSlider("mouseRight"); > > vector3 direction( 0.0f, 0.0f, 0.0f); > if(left > 0.0f) > { > direction.x = -1.0f; > SendMoveDirection(direction); > } > if(right > 0.0f) > { > direction.x = 1.0f; > SendMoveDirection(direction); > } > //if(right == 0.0f && left == 0.0f) > // this->SendMoveStop(); > } > > InputProperty::OnBeginFrame(); > } > > void > PlayerInputProperty::SendMoveDirection(vector3 dir) > { > Ptr<Message::MoveDirection> msgDir = > Message::MoveDirection::Create(); > msgDir->SetDirection(dir); > this->GetEntity()->SendAsync(msgDir); > } > --- > You didn't tell if you entity actually catch the input or not. 1) to read mouse imput the default mapping are vwrLeft, vwrRight etc... ( data/script/startup.tcl#OmMapInput, loaded from mangalore/input/server.cc ) so it seem you change them, is your mapping actually work ??? 2) sound stupid but has your entity have input focus ???, if I'm correct by default the camera get it 3) I move my app to message sink but for reading mouse I used to use this code : float x_move = inputServer->GetSlider( "vwrLeft" ) - inputServer->GetSlider( "vwrRight" ); float y_move = inputServer->GetSlider( "vwrDown" ) - inputServer->GetSlider( "vwrUp" ); -- for my 3d work it's over there --> http://j.a.l.free.fr/3dsmax update 26 Aug 2006 ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementYou didn't tell if you entity actually catch the input or not. Yes, the mapping works, my entity goes down at the moment, when I move the mouse (still no matter if I move the mouse left or right, entity goes down). I've tried vwrLeft/vwrRight, but when using them mangalore throws a notice message box every frame, that it is falling back to Nebula2 input system (nInputServer). And the "mouseLeft"/"mouseRight" mapping names are taken from mangalore/properties/pointnclickinputproperty.h function PointNClickInputProperty::OnMmbPressed(). 2) sound stupid but has your entity have input focus ???, if I'm correct by Yes, I set the input focus like this, when initializing my gamestate: --- Ptr<Game::Entity> player = Managers::EntityManager::Instance()->GetEntityByName("Player"); Managers::FocusManager::Instance()->SetInputFocusEntity(player); --- 3) I move my app to message sink but for reading mouse I used to use this code : Thanks for this advice, I'll use this from now. Well while doing some debugging and logging, I see that not only my X coordinate in transformation matrix changes, but also Y. But I do not change it. I have an idea, that there's somekind of gravity vector involved while doing transformations (my entity has ActoryPhysicsProperty). I haven't seen one being documented in mangalore headers, but I'm sure there's another vector is involved during the transformation calculation. Or maybe I've found a bug? Maybe someone more familiar with mangalore than I am, could see where am I wrong? Thanks in advance, Julius Seporaitis ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementWell, found one gravity vector in Physics::Level, but even if changing it during initialization (or every frame), my entity still falls down.
I change the gravity vector like this: --- Ptr<Physics::Level> level = Physics::Server::Instance()->GetLevel(); level->SetGravity(vector3(0.0f, 0.0f, 0.0f)); --- Have tried zero vector, and positive gravity - same result, my player goes down. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementvery dumb question from my side, but have you something like a ground
plane where your entity is placed on ? Tom Julius Seporaitis wrote: > Well, found one gravity vector in Physics::Level, but even if changing > it during initialization (or every frame), my entity still falls down. > > I change the gravity vector like this: > > --- > Ptr<Physics::Level> level = > Physics::Server::Instance()->GetLevel(); > level->SetGravity(vector3(0.0f, 0.0f, 0.0f)); > --- > > Have tried zero vector, and positive gravity - same result, my player > goes down. > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > > *** NOTE: To reply to the list use "reply to all", *** > *** to reply direct to the sender use "reply" *** > _______________________________________________ > Nebuladevice-discuss mailing list > Nebuladevice-discuss@... > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementJulius Seporaitis On 11/14/06, Ghoust <ghoust@...> wrote:
very dumb question from my side, but have you something like a ground ------------------------------------------------------------------------- SF.net email is sponsored by: A Better Job is Waiting for You - Find it Now. Check out Slashdot's new job board. Browse through tons of technical jobs posted by companies looking to hire people just like you. http://jobs.slashdot.org/ *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Problems with entity movementYou can disable gravity on a per object base. see rigidbody.h for the
functions. Setting the gravity of your level shoud do it also as this sets the ode gravity for the whole level, perhaps a bug? Be sure to set the gravity before your level is loaded, or to reinitialize physics on your objects as it could be possible that your object already has a velocity on the frame you set the gravity to 0. Best to do if you have questions in physics direction is to look at the ode documentation. Tom Julius Seporaitis wrote: > Well no, actually, I just need that my entity react to MoveDirection, > MoveStop messages, and as far as I've investigated - only > ActorPhysicsProperty supports such messages. I've tested my program > with ground environment object, and yes - my entity is not falling > down, but keeps sliding on the ground. Thanks for suggestion, but > still, isn't there any way to overcome this need-for-ground-object ? > > Julius Seporaitis > > On 11/14/06, *Ghoust* <ghoust@... <mailto:ghoust@...>> wrote: > > very dumb question from my side, but have you something like a ground > plane where your entity is placed on ? > > Tom > > Julius Seporaitis wrote: > > Well, found one gravity vector in Physics::Level, but even if > changing > > it during initialization (or every frame), my entity still falls > down. > > > > I change the gravity vector like this: > > > > --- > > Ptr<Physics::Level> level = > > Physics::Server::Instance()->GetLevel(); > > level->SetGravity(vector3(0.0f, 0.0f, 0.0f)); > > --- > > > > Have tried zero vector, and positive gravity - same result, my > player > > goes down. > > > ------------------------------------------------------------------------ > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > security? > > Get stuff done quickly with pre-integrated technology to make > your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> > > > ------------------------------------------------------------------------ > > > > > > *** NOTE: To reply to the list use "reply to all", *** > > *** to reply direct to the sender use "reply" *** > > _______________________________________________ > > Nebuladevice-discuss mailing list > > Nebuladevice-discuss@... > <mailto:Nebuladevice-discuss@...> > > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> > > *** NOTE: To reply to the list use "reply to all", *** > *** to reply direct to the sender use "reply" *** > _______________________________________________ > Nebuladevice-discuss mailing list > Nebuladevice-discuss@... > <mailto:Nebuladevice-discuss@...> > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss > <https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss> > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > SF.net email is sponsored by: A Better Job is Waiting for You - Find it Now. > Check out Slashdot's new job board. Browse through tons of technical jobs > posted by companies looking to hire people just like you. > http://jobs.slashdot.org/ > ------------------------------------------------------------------------ > > > *** NOTE: To reply to the list use "reply to all", *** > *** to reply direct to the sender use "reply" *** > _______________________________________________ > Nebuladevice-discuss mailing list > Nebuladevice-discuss@... > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
| Free embeddable forum powered by Nabble | Forum Help |