[Blog] BuggySwires/Mistletoe - Working Animated Characters!

betajaen

25-11-2010 11:38:10

This is the blog post for NxOgre 1.7 "BuggySwires"

All NxOgre repositories (nxogre, critter and nxogretutorials) have a new branch named "buggyswires", this is my working branch. After it's namesake buggyswires is intended to be a small one.

It's primary and only goals are

- To have a working character controller.
- To have a working AnimatedController.
- Any fix any outstanding bug fixes from Detritus (If you believe you have found a bug, let me know!)
- To post any remaining tutorials that haven't been published yet.
- "Unity Build" style fast build system#Guardsman
- Visual Studio 2010 support#Comment, VS 2008 automatically generated by Ruby scriptGrate.
Downloads

As this branch is now my working branch, you may want to use the latest stable branch which is Detritus, which is the default branch at Github.

NxOgre
Github page
Source code

Critter
Github page
Source code

Tutorials
Github page
Source code

betajaen

09-12-2010 18:24:36

BuggySwires/Guardsman

- Added UnityBuild project for instant building.
- Added CharacterController::_setShapeGroup
- Added NxActorFunctions class
- Switched to BuildBot for Versioning and SDK creation.

betajaen

10-12-2010 15:49:59

BuggySwires/Grate

- Switched to UnityBuild system only for Users.
- Updated BuildBot to write pre-Visual Studio 2010 solution and project files.


BuggySwires/Virtue

- Added "force" option to BuildBot version name.
- Fixed VC9 project.

betajaen

11-12-2010 22:26:50

[attachment=0]anim.jpg[/attachment]

Critter/BuggySwires/Fireman

- Created Node class.
- Added Animation support.
- Added AnimationState class.
- Switched to BuildBot system using Unity Build.
- Added Visual Studio 2010, 2008, 2005 configurations.


Critter/BuggySwires/Brewing

- Fixed Fade out animation.
- Added Node::getAnimation


---

I'd appreciate if anyone had some spare moments by downloading the new Critter and NxOgre version and try compiling it for me. I haven't tested the new Unity Build system on anything but Visual Studio 2010, and I have no idea if it works or not. ;)

betajaen

12-12-2010 12:00:21

Critter/BuggySwires/Daffodil

- Can get a specific status on an AnimationState in Node.
- Added Animation Speed option to Node (Node::setCurrentAnimationSpeed)
- Removed unwanted debug information from (RenderSystem::addAnimation)
- Can create/destroy nodes in RenderSystem.

obuil

13-12-2010 07:07:00

e:\vr\ogre\nxogre\buggyswires\nxogre1.7\sdk\nxogrehashmap.h(188) : error C2039: “at”: is not member of “std::map<_Kty,_Ty>”

crash in nxogrehashmap.h in vs 2008 sp1

betajaen

13-12-2010 09:16:57

Weird, I thought "at" was a standard function. I'll switch it to operator[].

spacegaier

13-12-2010 12:54:17

Weird, I thought "at" was a standard function.
Me too. Never had troubles using it so far...

betajaen

13-12-2010 13:41:08

BuggySwires/Reinforce

- Switched from "at" to "operator[]" on STL containers, due to a reported incompatibility with older Visual Studio versions.

@obuil
Try it now and see how it works with you. I didn't test it, but it did compile with Critter, so it should be okay.

betajaen

13-12-2010 21:54:25



Critter/BuggySwires/Melody

- Added Background Character with Falling, Landing, Idle and Forward states of animation and movement.
- Added Node::getCurrentAnimationEnded
- Added CharacterInput and CharacterInputHelper structs



I'll be posting a full new tutorial (with some others) in a few days, but for now I'll briefly explain what it is. Background Characters are intended to be used for NPCs, Low-Resolution characters, or Characters controlled by Steering behavior. This is one of two types of characters planned for Critter, the other is a "LeadingCharacter" for the protagonist in your game or application.

Both Characters are controlled by an CharacterInput struct (which has a CharacterInputHelper helper struct to aid you), it tells the character the direction to go and speed, but not an exact position. You can also tell it to do other things such as play animation, or start to climb a ladder, etc.

Anyway, this is an early "beta" of the Character Controller system for now. Your obviously welcome to try it out, but I expect there will be some bugs and problems along the way.

betajaen

14-12-2010 08:42:23

BuggySwires/Subcast

- Renamed CharacterController::lastCollisionUp/lastCollisionDown/lastCollisionSides to hasCollidedUp/hasCollidedDown/hasCollidedSides
- Added CharacterController::hasPreviouslyCollidedUp/hasPreviouslyCollidedDown/hasPreviouslyCollidedSides


Critter/BuggySwires/Pieless

- Updated Critter.cpp for UnityBuild.

betajaen

15-12-2010 18:14:09

BuggySwires/Bathtub

- Added Vec3::axis and Vec3::used functions.

Critter/BuggySwires/Tearing

- Added setJumpVelocityFromMaxHeight and setJumpVelocityFromMaxTime function helpers to BackgroundCharacterDescription
- Added Jump movement and animation to background characters.


Jumping added! Try it out ;)

betajaen

20-12-2010 22:07:03

BuggySwires/Mistletoe

- Added JointHelper class
- Added configuration to the Visual Debugger; via VisualDebuggerDescription
- VisualDebugger::setVisualisationMode split into VisualDebugger::enable/disable
- Removed Enums::VisualDebugger enum.



Critter/BuggySwires/Holly

- Added Microsoft Excel Sheet, to calculate jump velocities for Character Controllers
- Body/KinematicBody now only update the SceneNode on the proper time in the timestep.
- Bugfix: When Nodes get animation information, they return early when there is no skeleton
- Updated Critter to NxOgre/BuggySwires/Mistletoe
- Updated to new VisualDebugger system
Use: RenderSystem::createVisualDebugger and RenderSystem::destroyVisualDebugger

Terry

23-12-2010 08:26:29

Hi betajaen

We are creating a Game Editor Using Ogre and NxOgre and things are fine we have Up Graded to the new Nxogre and Critter on Buggy Swires for the character controler.

There are 2 routines that are vital to us that dont seem to exsist.

For advanceing a Kinetic Or Body Object.

Kinetic->advance(1,NxOgre::Enums::Priority_High);
Body->advance(1,NxOgre::Enums::Priority_High);

And also the ability to Pause Resume the Physics Engine.

mTimeController->pause()
and

mTimeController->resume();

The Syntext might not be right but i think you know which ones i am on about not expecting before Xmas but if you could look and add back would be doing us a great favour.

Thanks Terry Bernie

betajaen

23-12-2010 09:24:46

Your not supposed to use the KinematicBody/Body advance functions.

If you want to control time use; mWorld->advance(deltaTime) when you need it.

Terry

23-12-2010 09:38:43

Oh thats a shame thay where Great API for an Editor the ability to pause the Engine and just advance a individualy Physics Item ok will have to find a work around.

Shame thay worked perfectly.

Thanks anyway and merry Xmas.

Terry Bernie

betajaen

23-12-2010 10:13:04

You can pause/resume the World as you like. Just control the flow or time (or not) through mWorld->advance(...). You can't just give out time to specific parts of PhysX, but you can freeze dynamic/kinematic Actors from moving which would give a similar effect.

f00bar

05-01-2011 19:38:25

Hi betajaen,

I did a fresh checkout, and now the tutorials have only vc2010 project files. Can you generate vc2008 projects? I did not find an easy way to do that with google and thought you have written that you have a ruby script for that.

Thanks

betajaen

05-01-2011 19:47:33

No, but I have merged all the tutorials into a single project. So it will be easy to create a 2008 project from that using BuildBot. I've only done 101, 102, 107 so far, but the others are very easy to merge into (remove duplicate functions, change .cpp to .h).

f00bar

05-01-2011 20:53:57

ok, thanks.

As a quick fix, I executed the following line in the nxogretutorials\build folder, assuming there is a subfolder vc9 which contains the old (or a working) NxOgre101.vcproj. This file will be used as template and the occurences of the tutorial number will be replaced:

it is bash script (executed with cygwin):


find . -name "*.cpp" | grep -v NxOgre101 | grep -v Sandbox | while read f
do
echo "found cpp file: $f"
tutnr=`echo "$f" | sed 's/\.cpp//g' | sed 's#.*/.*/##g'`
echo "creating proj for: $tutnr"
cat vc9/NxOgre101.vcproj | sed \
-e "s/101/${tutnr}/g" \
> vc9/NxOgre${tutnr}.vcproj
done


worked for me. most examples compiled, and for those that didn't I think there are other reasons.

deshan

14-01-2011 18:42:42

Hello Betajaen

The link provided at
NxOgre -- The Guide to Everything -> 2nd post ->Awesome -> Latest Critter commit
seems to be broken, it points to follwoing url
https://github.com/betajaen/critter/tree/detritus

So think my critter is old, when compile buggyswires tutorisla i get some errors
error C2039: 'createTerrain' : is not a member of 'Critter::RenderSystem'
error C2039: 'setVisualisationMode' : is not a member of 'Critter::RenderSystem'
error C2039: 'VisualDebugger_ShowAll' : is not a member of 'NxOgre::Enums'
error C2039: 'playAnimation' : is not a member of 'Critter::BackgroundCharacter'
error C2039: 'is_turning' : is not a member of 'Critter::CharacterInput'


took critter from
https://github.com/betajaen/critter/tree/buggyswires

Could you please provide the latest critter url?

Thanks

deshan

betajaen

14-01-2011 18:48:05

That's the latest one.

As for your errors:

- I've disabled Terrain now in Critter, you can re-enable it via the Configuration header. But in future release, I'm going to take it out.
- setVisualisationMode is now createVisualDebugger
- VisualDebugger_ShowAll see above.
- Doesn't exist anymore.
- Ditto.

deshan

14-01-2011 20:36:42

Thanks for the information.

I will look into it.

Terry

17-01-2011 19:39:45

Hi betajaen

Just reading a post in this section where you state.

“I've disabled Terrain now in Critter, you can re-enable it via the Configuration header. But in future release, I'm going to take it out.”

Does this mean you are not going to support Ogre Terrain any more and if so why we use the CreateTerrain api modified a bit to get it to work but it does work or do you intened to use a differant method.

Thanks
Terry and Bernie

betajaen

17-01-2011 19:55:38

I'm not going to support it anymore. My implementation has always been buggy and when running reduces the FPS of the application considerably. There is a better version of the Wiki.

Besides; Converting Ogre Terrain into an NxOgre one, is trivial - 10 lines tops.

Terry

17-01-2011 20:03:22

HI Again betajaen
Well thats a shame realy is ok.

Can you then help us and other users do you have a link to the wiki topic you are on about and please please show us the 10 lines of code that so the same would be a great help in finding an alternative to the problem.

Thanks
Terry Bernie

betajaen

17-01-2011 20:22:14

It's this one; http://www.ogre3d.org/tikiwiki/NxOgreTerrainHeightfield

I should point out, that there are many terrain options for Ogre. I don't think I should pick favourites.

Terry

17-01-2011 20:38:34

Ok betajaen

None of that code will work with BuggySwires NxOgre::Terrain does not exsist for a start and many othere calls i should imagine dont work or have been altered is it possible to show us the Trivial 10 lines of code here so not just us but othere user can see it does it involve cooking it or somthing can you show us please the code on the wiki is not compatable with BuggySwires code and we need that for the charactor controler.

So Please please post code.

Thanks again
Terry Bernie

Terry

17-01-2011 23:15:18

Hi betajaen

I don’t mean to be a pain but we have been developing an editor for nearly a year that relies on the Terrain collision system you had.

Now the code from the wiki wont work with Buggy wires or maybe it will with different calls etc.

Can you show us the lines of code you suggested please this is a big thing for us do we have to cook it save it load it. Can you give us guidance in this matter or show us the ten lines of code you suggested to convert an Ogre terrain to a NxOgre terrain it means a lot to us.

Thanks Again
Terry Bernie.

deshan

18-01-2011 03:25:50

Hello Terry,

Have you looked into this topic.

viewtopic.php?f=6&t=13865

Highfield with cc works fine for me. I have the latest nxogre/critter.

~deshan

Terry

18-01-2011 19:35:13

Thanks deshan


Thanks for pointing us in the right direction a great help and we can see a solution now to the problem when betajaen drops the terrain API.

betajaen i dont know what to say to you thanks and dissapointed shame you cant fix the api and you responce to a solution for the situation when you drop it was vague and of no use what so ever there generaly is a soultion to most things but to say there is one and say its trivial but not acctualy post it is again a disapointing thing is its in your head but would have been nice if you could have relayed that info so we can get it in our heads.

Thanks
Terry Bernie

betajaen

18-01-2011 20:44:34

It's been well known that the terrain code in Critter has problems. Every time a new user compiles the NxOgreTutorials there is a comment that the 117 tutorial crashes or has poor FPS. So in the last few commits I've disabled it via the preprocessor. Eventually, I'll take the two functions out. The code is almost a copy/paste off the Wiki code anyway - it isn't exactly special.

There are plenty of terrain options available to Ogre and NxOgre is open enough to accept all of them through the ManualHeightfield class. I don't want to play favourites anymore, or give the impression that Ogre Terrain is the only terrain system it supports.

deshan

20-01-2011 03:40:32

betajaen i dont know what to say to you thanks and dissapointed shame you cant fix the api and you responce to a solution for the situation when you drop it was vague and of no use what so ever there generaly is a soultion to most things but to say there is one and say its trivial but not acctualy post it is again a disapointing thing is its in your head but would have been nice if you could have relayed that info so we can get it in our heads.

Betajaen has done very good work here. Developing/maintaining bunch of apis, writing tutorials, answering questions. That is not so easy.
BTW this solution always helped me much
http://lmgtfy.com/?q=ogre+terrain+with+nxogre
:D

@Betajaen
Your new profile picture, is that your pet?

Terry

20-01-2011 07:11:39

Hi betajaen

We have upgraded to the latest NxOgre and Critter and have to say well done mate starting to be a good implementation. of the character controller But I have a few questions.

1:- Does the character controller work with Terrain either CreateTerrain or the wiki version I have tried to set the Group to 1 i.e. wall.

NxOgre::SceneGeometry *Ter= Nx_mRenderSystem->createTerrain(mTerrain);
Ter->setGroup(1);

and various other attempts using the ManualHeightField to no avail can it be done in the CC set-up desc.mCollisionMask = (Walls << 1) | (Objects << 1); So is it possible.


2:- The CC walks forward back left and right with no problems but can the CC be rotated around the yaw I can set Sinbad to an angle in the yaw but he doesn’t walk in the forward facing direction of the character but in the world x or z so will you be including rotation at some point so the character can turn.

Thanks

Terry Bernie

PS

I am sorry if I got a bit up tight betajaen was a but frustrated with the terrain issue and I know you work hard and answer question very promptly and writing any good API can be changeling so I do apologize and carry on with the great work.

betajaen

20-01-2011 08:05:55

1. Yes, it should walk on terrain but the terrain must be marked as "Walkable" in the same way that you do with your normal objects.

2. I haven't finished the Yaw yet, I'm hoping to work on it this weekend.


It's okay, I can understand your frustration. But as deshan pointed out, NxOgre is a big API to maintain. ;)

@deshan

Yep, that's Coco, one of our Siamese cats.

Terry

20-01-2011 08:53:25

Thanks betaJaen

The only thing I will say is a lot of users follow you and write games application with Ogre and use your wrapper and What you have done is fantastic and you are dedicated and maintain it so all good.

But when you drop an API or accesses to variables or function we had accesses too then to do an upgrade to the next version of NxOgre it can be a rewrite of function in the user code and can be time consuming to fix things or find solutions to the problem.

Maybe keep it backwards compatible for as long as you can and also over time users user will use new API and then drop the old.


Sounds like I complaining and I am not but as a programmer my self your work is again fantastic but need to think about the user of the API.

Again thanks

Terry Bernie

Terry

20-01-2011 21:02:14

Thanks betajaen

Used the HeightFieldGeometryDescription as you said hf_desc.mGroup = 1 and works a treat with Terrain.

Thanks mate

Terry Bernie

Terry

03-03-2011 22:53:02

Hi betejaen

Was wondering how the yaw for the character controller was coming along eagerly waiting for it.

Also would it be possible to gain the position of the CC in a Vec3 or something.

Thanks

Terry Bernie

betajaen

04-03-2011 07:10:41

It's been in for weeks now through the last commit.

deshan

05-03-2011 10:17:40

It's been in for weeks now through the last commit

Please note that for turn functionality, the function definition is not their in CharacterInputHelper.cpp

@Terry
If it's needed just try out bad way.

Following is what I have done. Used this for testing, jump like operations not working.

use NxOgre::CharacterController::move function for drive the character to the desired direction.

And use Ogre for of setting camera directions.

cameraNode->pitch(Ogre::Degree(pitchValue));
cameraNode->yaw(Ogre::Degree(yawValue), Ogre::Node::TransformSpace::TS_WORLD);


Then calculate displacement vector which is to input to CharacterController::move()

NxOgre::Vec3 displacement;
displacement = currentScene->getGravity();

Ogre::Radian yRotation = cameraNode->_getDerivedOrientation().getYaw();

// addToDirection value should calculate based on keyinput (W,S,A,D), see below
direction = Ogre::Quaternion(yRotation + addToDirection, Ogre::Vector3::UNIT_Y) * Ogre::Vector3::NEGATIVE_UNIT_Z;

/********************** the physics way(2nd way) to calculate above direction value (Took From physics sdk example character controller)

Ogre::Real Cos = Ogre::Math::Cos(yRotation );
Ogre::Real Sin = Ogre::Math::Sin(yRotation );

Ogre::Matrix3 RotX(1, 0, 0, 0, Cos, -Sin, 0, Sin, Cos);

Ogre::Radian gTargetYaw = Ogre::Quaternion(yRotation + addToDirection, Ogre::Vector3::UNIT_Y).getYaw();

Cos = Ogre::Math::Cos(gTargetYaw + Ogre::Radian(3.141592653589793f));
Sin = Ogre::Math::Sin(gTargetYaw + Ogre::Radian(3.141592653589793f));

Ogre::Matrix3 RotY(Cos, 0, Sin, 0, 1, 0, -Sin, 0, Cos);

Ogre::Matrix3 ViewMat = RotY*RotX;

direction = ViewMat.GetColumn(2);
*/


NxOgre::Vec3 horizontalDisp = direction;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

displacement += horizontalDisp;

character->move(displacement * timeSinceLastFrame * 30);



this is how i calculated addToDirection value
parameter movemetType is one of folliwng, based on WSAD
enum Movements
{
MOVE_FORWARD,
MOVE_BACKWARD,
MOVE_LEFT,
MOVE_RIGHT
};

void PlayerCharacterCCImp::moveCharacter(int movemetType)
{

if (MOVE_FORWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(0));
}
}
else if (MOVE_BACKWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(180));
}
}
else if (MOVE_LEFT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(90));
}
}
else if (MOVE_RIGHT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(-90));
}
}
}


Complete class
PlayerCharacterTPCCImp .h

#ifndef GAME_PLAYERCHARACTER_THIRDPERSON_CCIMP_H
#define GAME_PLAYERCHARACTER_THIRDPERSON_CCIMP_H

#include "GamePlayerCharacter.h"
#include "GameHelper.h"

namespace GameSoundManager
{
class SoundPlayer;
}

namespace Game
{
namespace Player
{
namespace Character
{
class PlayerCharacterTPCCImp : public PlayerCharacter
{
public:
PlayerCharacterTPCCImp(CCPlayerDescription &pDesc);
~PlayerCharacterTPCCImp();

Ogre::Vector3 getPosition();

void setPosition(Ogre::Vector3 pos);

void moveCharacter(int moveType); // overrides functionality (At the Moment)

void stopCharacter(int stopType); // overrides functionality (At the Moment)

void jump(); // overrides functionality (At the Moment)

void startTestMove(); // remove later

void stopTestMove(); // remove later

void reset(Ogre::Vector3 pos);

void update(double);

private:
int playerHight;

Critter::AnimatedCharacter* gCharacter;

CCPlayerDescription playerDescription;

Critter::CharacterInputHelper inputHelper;

Ogre::Real speedFactor;

};
}
}
}

#endif


cpp


#include "GamePlayerCharacterCCImp.h"
#include "GamePlayerCameraFP.h"
#include "GameEnums.h"
#include "Critter.h"
#include "NxOgre.h"
#include "GameMacros.h"

using namespace Game::Player::Camera;
using namespace Game::Player::Character;

PlayerCharacterCCImp::PlayerCharacterCCImp(CCPlayerDescription &playerDesc) : PlayerCharacter(), playerDescription(playerDesc)
{
classID = enums::Player::Characters::CHARACTERS_PLAYERCHARACTERCC_ID;

addToDirection = Ogre::Radian(Ogre::Degree(0));

// BackgroundCharacterDescription Description Starts here
Critter::AnimatedCharacterDescription bcDescription;
bcDescription.mCollisionMask = (enums::Player::ControllerShapeGroups::CSGROUPS_WALL << 1) | (enums::Player::ControllerShapeGroups::CSGROUPS_OBJECT << 1);
bcDescription.mMaxGroundSpeed = 17.0f;
bcDescription.mStepOffset = 3;
bcDescription.mShape = NxOgre::SimpleCapsule(playerDesc.height, playerDesc.radious);
bcDescription.setJumpVelocityFromMaxHeight(Game::Mission::MissionCommon::currentScene->getGravity().y, 2.75f);

// Input to the createBackgroundCharacter method
Critter::Node* node = Game::Mission::MissionCommon::currentRenderSystem->createNode();

playerSceneNode = node->createChildSceneNode();

// Crerate Character Controller
gCharacter = Game::Mission::MissionCommon::currentRenderSystem->createAnimatedCharacter(playerDesc.position, Ogre::Radian(0), node, bcDescription);

// Camera description starts here
FPCameraDescription fpCamDesc;
fpCamDesc.camera = Game::Mission::MissionCommon::currentCamera;
fpCamDesc.cameraNode = playerSceneNode->createChildSceneNode(Ogre::Vector3(0,0,0));
fpCamDesc.invert = false;
fpCamDesc.maxPitch = 60;
fpCamDesc.minPitch = -60;

playerCamera = new PlayerCameraFP(fpCamDesc);

character = reinterpret_cast<NxOgre::CharacterController*>(gCharacter);

inputHelper.reset();
}

PlayerCharacterCCImp::~PlayerCharacterCCImp()
{
delete playerCamera;
}

Ogre::Vector3 PlayerCharacterCCImp::getPosition()
{
return playerSceneNode->_getDerivedPosition();
}

void PlayerCharacterCCImp::setPosition(Ogre::Vector3 pos)
{
character->setPosition(pos);
}

void PlayerCharacterCCImp::moveCharacter(int movemetType)
{
// call to super
MovingCharacter::moveCharacter(movemetType);

if (MOVE_FORWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(0));
}
}
else if (MOVE_BACKWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(180));
}
}
else if (MOVE_LEFT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(90));
}
}
else if (MOVE_RIGHT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(-90));
}
}
}

void PlayerCharacterCCImp::stopCharacter(int stopType)
{
// call to super
MovingCharacter::stopCharacter(stopType);

if (MOVE_FORWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(0));
}
}
else if (MOVE_BACKWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(180));
}
}
else if (MOVE_LEFT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(90));
}
}
else if (MOVE_RIGHT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(-90));
}
}

if (!moving)
{
inputHelper.reset();
//character->move(NxOgre::Constants::MEAN_EARTH_GRAVITY);
}

}

void PlayerCharacterCCImp::jump()
{
// call to super
MovingCharacter::jump();
}

void PlayerCharacterCCImp::startTestMove()
{
// call to super
MovingCharacter::startTestMove();
}

void PlayerCharacterCCImp::stopTestMove()
{
// call to super
MovingCharacter::stopTestMove();
}



void PlayerCharacterCCImp::reset(Ogre::Vector3 pos)
{
Game::Mission::MissionCommon::currentCamera->detachFromParent(); // indeed nedded

Game::Mission::MissionCommon::currentCamera->setOrientation(Ogre::Quaternion::IDENTITY);
//Game::Mission::MissionCommon::currentCamera->yaw(Ogre::Radian(Ogre::Degree(180)));

playerCamera->getCameraNode()->attachObject(Game::Mission::MissionCommon::currentCamera);

setPosition(pos);
}

void PlayerCharacterCCImp::update(double timeSinceLastFrame)
{
NxOgre::Vec3 displacement;

displacement += Game::Mission::MissionCommon::currentScene->getGravity();

if (moving)
{
Ogre::Radian yRotation = playerCamera->getCameraNode()->_getDerivedOrientation().getYaw();

direction = Ogre::Quaternion(yRotation + addToDirection, Ogre::Vector3::UNIT_Y) * Ogre::Vector3::NEGATIVE_UNIT_Z;

NxOgre::Vec3 horizontalDisp = direction;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

displacement += horizontalDisp;

character->move(displacement * timeSinceLastFrame * 30);

/*displacement.z > 0 ?
inputHelper.forwardFractional(displacement.z):
inputHelper.backwardFractional(displacement.z);


displacement.x > 0 ?
inputHelper.rightFractional(displacement.x):
inputHelper.leftFractional(displacement.x);

gCharacter->setInput(inputHelper);*/

//character->move(displacement * timeSinceLastFrame * 30);

/*displacement = NxOgre::Constants::MEAN_EARTH_GRAVITY;

Ogre::Radian yRotation = playerCamera->getCameraNode()->_getDerivedOrientation().getYaw();

direction = Ogre::Quaternion(yRotation + addToDirection, Ogre::Vector3::UNIT_Y) * Ogre::Vector3::NEGATIVE_UNIT_Z;

NxOgre::Vec3 horizontalDisp = direction;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

displacement += horizontalDisp;

character->move(displacement * 0.05 * timeSinceLastFrame);*/

/*Ogre::Radian gTargetPitch = (playerCamera->getCameraNode()->_getDerivedOrientation()).getPitch();

Ogre::Real Cos = Ogre::Math::Cos(gTargetPitch);
Ogre::Real Sin = Ogre::Math::Sin(gTargetPitch);

Ogre::Matrix3 RotX(1, 0, 0, 0, Cos, -Sin, 0, Sin, Cos);

Ogre::Radian gTargetYaw = Ogre::Quaternion(playerCamera->getCameraNode()->_getDerivedOrientation().getYaw() + addToDirection, Ogre::Vector3::UNIT_Y).getYaw();

Cos = Ogre::Math::Cos(gTargetYaw + Ogre::Radian(3.141592653589793f));
Sin = Ogre::Math::Sin(gTargetYaw + Ogre::Radian(3.141592653589793f));

Ogre::Matrix3 RotY(Cos, 0, Sin, 0, 1, 0, -Sin, 0, Cos);

Ogre::Matrix3 ViewMat = RotY*RotX;

NxOgre::Vec3 xxx = ViewMat.GetColumn(2);


//----
NxOgre::Vec3 disp = NxOgre::Constants::MEAN_EARTH_GRAVITY;

NxOgre::Vec3 horizontalDisp = xxx;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

disp += horizontalDisp;

character->move(disp * 0.4);*/

}
else
{
gCharacter->setInput(inputHelper);
}




}

betajaen

05-03-2011 10:20:56

It's been in for weeks now through the last commit

Please note that for turn functionality, the function definition is not their in CharacterInputHelper.cpp


That's odd. I remember turning around with my Xbox 360 gamepad when developing it. I'll take a second look this weekend though.

deshan

05-03-2011 10:31:16

yup I am getting following when
use turn function
1>GamePlayerCharacterTPCCImp.obj : error LNK2001: unresolved external symbol "public: void __thiscall Critter::CharacterInputHelper::turn(class Ogre::Degree,class Ogre::Degree)" (?turn@CharacterInputHelper@Critter@@QAEXVDegree@Ogre@@0@Z)
1>bin\Debug\TheGameProject_d.exe : fatal error LNK1120: 1 unresolved externals

betajaen

05-03-2011 10:40:22

Ahh.

You can just set the variables of the CharacterInput class directly, if you like. The functions are just helper functions.

This is what I used when developing the Character Controller, I used my Xbox 360 control pad with OIS:


mJoyStick->capture();

const OIS::JoyStickState& js = mJoyStick->getJoyStickState();

// This is written with an XBOX 360 Controller in mind, and will probably be different for other kinds.
// 0 - Up/Down (Forward, backward)
// 1 - Left/Right (Turn left, Turn Right)
// Bumper Left (Side step left, Side step right).

float margin = 0.35;

float forward_backward = float(-js.mAxes[0].abs) / 32768.0f;
float left_right = float(-js.mAxes[1].abs) / 32768.0f;

if (js.mAxes[1].abs != 0)
mSinbadHelper.input.is_turning = true;

if (NxOgre::Math::abs(forward_backward) >= margin)
{
forward_backward *= 127;
mSinbadHelper.input.forward_backward = int(forward_backward);
}

if (NxOgre::Math::abs(left_right) >= margin)
{
left_right *= 127;
mSinbadHelper.input.left_right = int(left_right);
}

if (js.mButtons[0])
{
mSinbadHelper.input.up = true;
}


if (js.mButtons[4])
{
mSinbadHelper.input.is_turning = false;
mSinbadHelper.right();
}


if (js.mButtons[5])
{
mSinbadHelper.input.is_turning = false;
mSinbadHelper.left();
}
}

mSinbad->setInput(mSinbadHelper);


// Advance NxOgre.
mWorld->advance(evt.timeSinceLastFrame);
return SdkSample::frameRenderingQueued(evt);



Basically, to turn instead of side stepping. Just give your "angle" as through left/right between -127 and 128, and set is_turning to true, then pass it to the Character.

betajaen

06-03-2011 14:50:22

BuggySwires/Carrizo

- Bugfix; Added _destroyCharacterController to RigidBody



Critter/BuggySwires/Circuit

- Added missing CharacterInputHelper::turn functions


There you go.

That should stop the crashing when CharacterControllers are being destroyed, and I added the turn function for deshan.

deshan

06-03-2011 15:05:45

BuggySwires/Carrizo

- Bugfix; Added _destroyCharacterController to RigidBody



Critter/BuggySwires/Circuit

- Added missing CharacterInputHelper::turn functions


There you go.

That should stop the crashing when CharacterControllers are being destroyed, and I added the turn function for deshan.


With this I could remove accessing NxOgre::charactercontroller
Thanks you betajaen

betajaen

06-03-2011 16:34:19

With this I could remove accessing NxOgre::charactercontroller
Thanks you betajaen


You didn't need to in the first place.

I opened up the CharacterInput like that, so you bind can your input system in directly. As long as you know the rules of the class, and valid values you should be fine. The CharacterInputHelper class is there in case you don't want to.

deshan

06-03-2011 17:04:15

Thanks you for pointing out.

I am almost doing that.

Initially my target was to bringing one of my old (ogre + nxogre + physx) project to (ogre + nxogre).
It's nearly complete.

Now as you pointed I am focusing on bringing those new critter implementation and cutting down physx like codes.

Terry

19-03-2011 22:12:28

Hi betajaen

We have integrated the Charactor Controller in to our editor and all is going well but there is one thing the CC now yaws ok but jump does not jump in facing direction but in the world x and z wondering if this can be fixed.

deshan

Thanks for all youe advice realy impressed by the way you overcome the yaw situation before betajaen did the turn in the helper class just need to fix the jump situation now.

Thanks
Terry Berine

betajaen

19-03-2011 22:49:53

I'll have a quick look tomorrow if it's an easy fix. It probably is, since all the movement code is in one function.

Terry

19-03-2011 23:01:13

Ok And thanks much appreciated

I think thats about it there is one thing if possible the forward movement and backwards movement are 127 which is the Max Ground movement so we can scale the movement acordingly by the Max Ground / 127 but the rotation speed seems to be fixed is it also posible to have it connected to the max ground speed so its all proportional as such.

So as in Forward speed say as is now Max Ground speed say 100 so 127 is 100 and then if 68 its half the Max Ground speed can this also be applied to the turn the same maths.

Thanks
Terry Bernie

betajaen

19-03-2011 23:10:26

I'm half tired at the moment, but isn't there a maximum turning angle in the description? If not would that suffice?

Terry

19-03-2011 23:28:37

yes i see what you say but the turn rate is fixed at a MAX which you have set so 127 is the fastest we can turn set by you i think its 0.13* turn speed i cant remeber but the rest is a division of max ground speed so we can set the scope or what 127 means via Max ground speed but not on turn angle.

Anyway we will leave you rest but look forward to speaking tomoz.

Terry Bernie

deshan

20-03-2011 07:36:44

Hi Terry,

Have you tried out CC with terrain?

With inputhelper I have some issues. Because I could see some shake and slow movement when it move downward slope on the terrain.

betajaen

20-03-2011 08:04:41

yes i see what you say but the turn rate is fixed at a MAX which you have set so 127 is the fastest we can turn set by you i think its 0.13* turn speed i cant remeber but the rest is a division of max ground speed so we can set the scope or what 127 means via Max ground speed but not on turn angle.

Okay, I'll put in a flag so you can turn that way.

@deshan

It may be the falling code. I did intend to do a ray cast to check for things like this, you may have similar problems with going down stairs quickly.

deshan

20-03-2011 09:29:27

@deshan

It may be the falling code. I did intend to do a ray cast to check for things like this, you may have similar problems with going down stairs quickly.


yes betajaen, it seems so.
If I comment this, it's fine.

if (mIsFalling)
{
mIsFalling = false;
mAirUserDirection.zero();
playAnimation(Enums::StockAnimationID_Land, Enums::StockAnimationID_Land, Enums::StockAnimationID_Idle,Enums::StockAnimationID_Idle, true);
return;
}

betajaen

20-03-2011 11:43:32

What do you guys think of this?

struct CharacterInput
{

// Maximum walk speed.
short forward_backward : 16;

// Maximum sidestep speed, or turning value per timestep.
// Where 1 = turning_value
short left_right : 16;

// See Enums::TurningMode
unsigned char turning_mode : 2;

// Go up.
unsigned char up : 4;

// Go down
unsigned char down : 4;

// User properties.
unsigned short user : 16;

// UNKNOWN
unsigned char RESERVED : 6;

};


enum CharacterTurningMode
{
// userDirection.x = float(left_right) * ReciprocalOf32768 * mMaxGroundSpeed;
CharacterTurningMode_SideStep = 0,
// mYaw += Ogre::Radian(float(left_right) * turning_value)) * deltaTime;
CharacterTurningMode_Add_DeltaTime = 1,
// mYaw += Ogre::Radian(float(left_right) * turning_value));
CharacterTurningMode_Add = 2,
// mYaw = Ogre::Radian(float(left_right) * turning_value));
CharacterTurningMode_Set = 3
};


You'd have these in the Description (and get/set functions in AnimatedCharacter)

// Speed when sidestepping.
Ogre::Real mMaxSideStep;

// How many radians left_right is in CharacterInput.
Ogre::Real mTurningValue;


The up/down values go up to 16 now, which may be used for prone or larger jumping. Haven't decided yet.

Terry

20-03-2011 22:27:36

Hi Betajaen

Have you committed your new code ??

Cheers

Terry Bernie

betajaen

20-03-2011 22:45:53

No, I was prototyping some thoughts, and I wanted a few opinions.

Terry

20-03-2011 22:52:47

Are i see well it looks goodto me i dont know what dashan thinks i suppose the devils in the detail .

Terry Bernie

deshan

21-03-2011 03:56:17

What do you guys think of this?

struct CharacterInput
{

// Maximum walk speed.
short forward_backward : 16;

// Maximum sidestep speed, or turning value per timestep.
// Where 1 = turning_value
short left_right : 16;

// See Enums::TurningMode
unsigned char turning_mode : 2;

// Go up.
unsigned char up : 4;

// Go down
unsigned char down : 4;

// User properties.
unsigned short user : 16;

// UNKNOWN
unsigned char RESERVED : 6;

};


enum CharacterTurningMode
{
// userDirection.x = float(left_right) * ReciprocalOf32768 * mMaxGroundSpeed;
CharacterTurningMode_SideStep = 0,
// mYaw += Ogre::Radian(float(left_right) * turning_value)) * deltaTime;
CharacterTurningMode_Add_DeltaTime = 1,
// mYaw += Ogre::Radian(float(left_right) * turning_value));
CharacterTurningMode_Add = 2,
// mYaw = Ogre::Radian(float(left_right) * turning_value));
CharacterTurningMode_Set = 3
};


You'd have these in the Description (and get/set functions in AnimatedCharacter)

// Speed when sidestepping.
Ogre::Real mMaxSideStep;

// How many radians left_right is in CharacterInput.
Ogre::Real mTurningValue;


The up/down values go up to 16 now, which may be used for prone or larger jumping. Haven't decided yet.


This looks good. More control over character turning. Nice.
But I don't understand why char became short in move forward backward and left right?

I have one more question
Betajaen why is the reason for protected inheritance for Critter character controller?
Critter::characterController : protected NxOgre::Charactercontroller

betajaen

21-03-2011 08:24:42

This looks good. More control over character turning. Nice.
But I don't understand why char became short in move forward backward and left right?

I have one more question
Betajaen why is the reason for protected inheritance for Critter character controller?
Critter::characterController : protected NxOgre::Charactercontroller



I needed extra bits for the character turning mode, since the struct size has to be a power of two, it would have to grow to 64 bits. I switched to shorts for directional movement because forward on my XBox 360 controller is +32768, which I use as a baseline for input. This way you get much accuracy of movement. Same with up/down directions now, which can support different modes that are considered up or down. Large Jump, small jump, Crouching, Going Prone, etc.

As for inheritance; Custom movement code is used in the Animator Character, and I didn't want them using the standard move functions without the AnimatedCharacter knowing about it.

deshan

21-03-2011 10:46:54

Ah thanks betajaen for explanations.

Terry

23-03-2011 17:59:07

Hi betajaen

We are wondering how the jump situation is coming along in the Charactor Controller as its most weired the way it is it dosent jump in forward facing direction as we have siad.

Thanks
Terry Bernie

betajaen

23-03-2011 18:59:58

I found the bug, yesterday and think I fixed it. Along putting in my changes. Probably going to be until the weekend before I finish and test it out. But I've attached the related files here, so you can try it out anyway. Warning though; I haven't even tried to compile it, let alone use it. ;)

Terry

23-03-2011 22:42:10

Cheers betajaen

Karan

05-04-2011 16:34:40

Hi betajaen,

would be nice if you could expose the new NxPhysicsSDKDesc::gpuHeapSize parameter in NxOgre::WorldDescription. By default it's too small for the number of particles I want to simulate. From the 2.8.4 change log:
  1. Added extended scene statistics for GPU memory usage.[/*]
  2. Lowered the default GPU memory heap size to 32 MB from 128 MB. You may use NxPhysicsSDKDesc::gpuHeapSize to change how much GPU memory is allocated for physics.[/*]
    [/list:u]

Would be also nice to have an API for these extended scene statistics^^

betajaen

05-04-2011 17:03:36

I thought I did?

Karan

06-04-2011 12:44:32

Ah, yeah, but it's in LeaJean...nevermind, I hardcoded 64MB in Buggyswires for now...

betajaen

06-04-2011 12:54:08

Ah. Explains why I remembered coding it.

If you want to submit a patch, I'm willing to put it in for you.

Terry

16-04-2011 15:10:45

Hi betajaen

Wondering how the Jump code for ACC was coming along as we are in need of it as soon as posible.

Thanks

Terry Bernie

betajaen

16-04-2011 16:01:43

I worked on it for a little bit, but since then I haven't had any chance too.

If you want to have a stab at it, go ahead. It's all in one function, and fairly well written and straightforward.


I will try and make some time tomorrow to see if I can finish it. No promises though.

Terry

16-04-2011 16:53:22

That’s Excellent betajaen.

I think deshan could help as well see if we can work it out together.

Thanks

Terry Bernie

deshan

21-04-2011 19:33:57

Hi Terry,

Of course i am pleased to share my jumping code
It's not perfect, but moving and jumping works for me. please note that i took this code from physx CC samples and betajaens CC tutorials. specially made for First person.


Ogre::Real mJumpTime;
Ogre::Real mV0;
Ogre::Real totalJump;
Ogre::Radian addToDirection;

Critter::AnimatedCharacter* gCharacter = currentRenderSystem->createAnimatedCharacter(playerDesc.position, Ogre::Radian(0), node, bcDescription);
NxOgre::CharacterController* character = reinterpret_cast<NxOgre::CharacterController*>(gCharacter);

// key board space
void PlayerCharacterCCImp::jump()
{
if(jumping) return;
mJumpTime = 0.0f;
mV0 = 400;
totalJump = 0;

jumping = true;
}

// key board space
void PlayerCharacterCCImp::stopJump()
{
if(!jumping) return;

jumping = false;
}

// get hight data, vertical displacement
Ogre::Real PlayerCharacterCCImp::getHight(double timeSinceLastFrame)
{
if(!jumping) return 0.0f;
mJumpTime += timeSinceLastFrame;
Ogre::Real h = -9.8f * mJumpTime * mJumpTime + mV0 * mJumpTime;
Ogre::Real hight = (h - currentScene->getGravity().y) * timeSinceLastFrame;

if(hight > 0)
{
totalJump += hight;
if (totalJump > 25)
stopJump();
}
return hight;
}

// move type (W,S,A,D)
void PlayerCharacterCCImp::moveCharacter(int movemetType)
{
// call to super
MovingCharacter::moveCharacter(movemetType); // set MOVE_FORWARD, MOVE_LEFT, MOVE_RIGHT, MOVE_BACKWARD values

if (MOVE_FORWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(0));
}
}
else if (MOVE_BACKWARD)
{
if (MOVE_LEFT)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else if (MOVE_RIGHT)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(180));
}
}
else if (MOVE_LEFT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(90));
}
}
else if (MOVE_RIGHT)
{
if (MOVE_FORWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-45));
}
else if (MOVE_BACKWARD)
{
addToDirection = Ogre::Radian(Ogre::Degree(-135));
}
else
{
addToDirection = Ogre::Radian(Ogre::Degree(-90));
}
}
}

void PlayerCharacterCCImp::update(double timeSinceLastFrame)
{
if (moving)
{
Ogre::Radian yRotation = playerCamera->getCameraNode()->_getDerivedOrientation().getYaw();

direction = Ogre::Quaternion(yRotation + addToDirection, Ogre::Vector3::UNIT_Y) * Ogre::Vector3::NEGATIVE_UNIT_Z;

NxOgre::Vec3 horizontalDisp = direction;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

displacement += horizontalDisp;

Ogre::Real heightDelta = getHight(timeSinceLastFrame);

if(heightDelta !=0.0f)
displacement.y += heightDelta;

character->move(displacement * timeSinceLastFrame * movingSpeed);

if(character->hasCollidedDown())
stopJump();

/* // physx way of rotation handing, using rotastion matrixes (No need)

Ogre::Radian gTargetPitch = (playerCamera->getCameraNode()->_getDerivedOrientation()).getPitch();

Ogre::Real Cos = Ogre::Math::Cos(gTargetPitch);
Ogre::Real Sin = Ogre::Math::Sin(gTargetPitch);

Ogre::Matrix3 RotX(1, 0, 0, 0, Cos, -Sin, 0, Sin, Cos);

Ogre::Radian gTargetYaw = Ogre::Quaternion(playerCamera->getCameraNode()->_getDerivedOrientation().getYaw() + addToDirection, Ogre::Vector3::UNIT_Y).getYaw();

Cos = Ogre::Math::Cos(gTargetYaw + Ogre::Radian(3.141592653589793f));
Sin = Ogre::Math::Sin(gTargetYaw + Ogre::Radian(3.141592653589793f));

Ogre::Matrix3 RotY(Cos, 0, Sin, 0, 1, 0, -Sin, 0, Cos);

Ogre::Matrix3 ViewMat = RotY*RotX;

NxOgre::Vec3 xxx = ViewMat.GetColumn(2);

NxOgre::Vec3 disp = NxOgre::Constants::MEAN_EARTH_GRAVITY;

NxOgre::Vec3 horizontalDisp = xxx;

horizontalDisp.y = 0.0f;

horizontalDisp.normalise();

disp += horizontalDisp;

character->move(disp * timeSinceLastFrame * movingSpeed);*/
}
else // still depends on betajane's input helper if not moving
{
gCharacter->setInput(inputHelper);
}
}

betajaen

21-04-2011 19:44:39

Nice! Thanks for posting.

The plans are for the CC. Is to fix that jumping bug (which I may of fixed already - but can't remember), and to check to see if callbacks work between characters and characters, and characters and non-characters.

deshan

23-04-2011 18:18:24

tried the callbacks for CC's and partially succeeded.
it works for Collidable and non pushable types, but didn't manage to get it work for collidable and pushable.

Pyritie

01-07-2011 15:27:03

All of this character controller work sounds very awesome and all but I'm using Mogre and eyecmphysx. Do you think it would be worth waiting until buggyswires is stable and then making a wrapper over it or should I just keep fighting with physx as it is?

betajaen

01-07-2011 15:39:55

BuggySwires is stable, go for it.

Pyritie

01-07-2011 19:19:50

Oh okay! Didn't know that since the first post and stickies still say that it's unstable and stuff. Also I don't really see anything on how to use critter or what it is besides that it's some sort of binding.

I've also never made a wrapper for anything before but I don't think it would be too hard... any tips on things I should keep in mind?

betajaen

01-07-2011 19:46:25

Wrapping a C++ library to C++/CLI is fairly straightforward, best example of usage is MOgre, as you probably already know.

Just be careful with pointers. You also may be able to get away with wrapping NxOgre with Swig.

SniperBinaire

04-07-2011 13:01:59

Be careful also with Character controller.
Buggy stuff underlying.

Also betajean, do you know how can I make my character looking around with mouse and moving sideways with directional keys at the same time ?

here's my code :

if(sys0.mKeyboard->isKeyDown( OIS::KC_LSHIFT ) || sys0.mKeyboard->isKeyDown( OIS::KC_RSHIFT ))movespeed=(56*inv_FPS,56*inv_FPS,56*inv_FPS);else movespeed=(7*inv_FPS,7*inv_FPS,7*inv_FPS);
if(sys0.mKeyboard->isKeyDown(OIS::KC_UP) || sys0.mKeyboard->isKeyDown(OIS::KC_W) ) local_player.inputHelper.input.forward_backward -= 30*movespeed.z;
if(sys0.mKeyboard->isKeyDown(OIS::KC_DOWN) || sys0.mKeyboard->isKeyDown(OIS::KC_S) ) local_player.inputHelper.input.forward_backward += 30*movespeed.z;
if(sys0.mKeyboard->isKeyDown(OIS::KC_A)) {local_player.inputHelper.input.left_right -= 30*movespeed.z;}
if(sys0.mKeyboard->isKeyDown(OIS::KC_D)) {local_player.inputHelper.input.left_right += 30*movespeed.z;}
if(camctrl)
{
rotation.y = -mouseY*0.2;
local_player.inputHelper.turn(-Degree(mouseX)*40,Degree(360));
mouseX = mouseY = 0;
local_player.rotate(rotation); // just rotate the camera verticaly
}
local_player.inputHelper.input.is_turning = camctrl;


My method do not work for A and D keys... (ie side steps)

Pyritie

04-07-2011 13:33:01

I was thinking that since the only thing I really want from this is that upgraded character controller I could just wrap/translate that myself... we'll see

Dboy85

24-11-2011 00:18:24

Did anyone get animated character vs animated character collisions working ?

I'm trying to implement it but no luck.

viewtopic.php?f=6&t=14976