[SOLVED]Common Problems

mironix

12-01-2011 23:46:58

I can't create a capsule. It may be a stupid small problem but i have this error code:

Error 3 error C2664: 'NxOgre::Capsule::Capsule(NxCapsuleShape *,bool)' : cannot convert parameter 1 from 'int' to 'NxCapsuleShape *'


when i do simply


desc.mMass = 0.0;
desc.mDensity = 1;
c.setDimensions(boneRadius,boneLength);
Ogre::Matrix4 * m = new Ogre::Matrix4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
a = scene->createActor(new NxOgre::Capsule(1000, 5000) ,m,desc);


when i look at nxOgreCapsule.h i see only one constructor



#ifndef NXOGRE_CAPSULE_H
#define NXOGRE_CAPSULE_H



#include "NxOgreStable.h"
#include "NxOgreCommon.h"


#include "NxOgreShape.h"
#include "NxOgreShapeDescription.h"
#include "NxOgreShapeFunctions.h"



namespace NxOgre
{



/*! class. Capsule
desc.
A Capsule is a capsule shape that can be used in Actors, KinematicActors, StaticGeometries and Volumes for
collisions and testing against them.

see. Shape
*/
class NxOgrePublicClass Capsule : public Shape
{

NXOGRE_GC_FRIEND_NEW2
NXOGRE_GC_FRIEND_DELETE

public: // Functions

unsigned int getShapeType() const;

/*! function. getShapeFunctionType
desc.
Get the shape type based upon the Classes::ShapeFunctionType enum.
return.
**ShapeFunctionType** -- This type of shape as a ShapeFunctionType enum.
*/
Enums::ShapeFunctionType getShapeFunctionType() const;

/*! function. setDimensions
desc.
Set the radius and height of the capsule.
args.
Real __radius__ -- Radius of the capsule
Real __height__ -- Distance between the top and bottom centres hemispheres of the capsule.
*/
void setDimensions(Real radius, Real height);

/*! function. setRadius
desc.
Set the radius of the capsule.
args.
Real __radius__ -- Radius of the capsule
*/
void setRadius(Real radius);

/*! function. setHeight
desc.
Set the height of the capsule.
args.
Real __height__ -- Distance between the top and bottom centres hemispheres of the capsule.
*/
void setHeight(Real height);

/*! function. getRadius
desc.
Get the radius of the capsule
return.
**Real** -- The radius of the capsule.
*/
Real getRadius() const;

/*! function. getHeight
desc.
Get the height of the capsule
return.
**Real** -- Distance between the top and bottom centres hemispheres of the capsule.
*/
Real getHeight() const;

/*! function. getWorldCapsule
desc.
Get the box represented as world space capsule.
note.
This function only works when the capsule is attached.
return. **SimpleCapsule** -- World space capsule when attached or SimpleCapsule with default values.
*/
SimpleCapsule getWorldCapsule();

/*! function. saveToDescription
desc.
Saves the capsule to a description
*/
void saveToDescription(CapsuleDescription&);

/*! function. to_s
desc.
Returns the pointer and name as string.
*/
String to_s() const;

protected:

/*
*/
Capsule(NxCapsuleShape*, bool isDirty = false);

/*
*/
~Capsule();

protected:

NxCapsuleShape* mCapsuleShape;

}; // class Capsule



} // namespace NxOgre

cpp

/**

This file is part of NxOgre.

Copyright (c) 2009 Robin Southern, http://www.nxogre.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/



#include "NxOgreStable.h"
#include "NxOgreCapsule.h"
#include "NxOgreShapeDescription.h"
#include "NxOgreCapsuleDescription.h"
#include "NxOgreSimple.h"

#include "NxPhysics.h"



namespace NxOgre
{



Capsule::Capsule(NxCapsuleShape* shape, bool isDirty)
: Shape(shape, isDirty), mCapsuleShape(shape)
{
}

Capsule::~Capsule()
{
}

unsigned int Capsule::getShapeType() const
{
return Classes::_Capsule;
}

Enums::ShapeFunctionType Capsule::getShapeFunctionType() const
{
return Enums::ShapeFunctionType_Capsule;
}

void Capsule::setDimensions(Real radius, Real height)
{
mCapsuleShape->setDimensions(radius, height);
}

void Capsule::setRadius(Real radius)
{
mCapsuleShape->setRadius(radius);
}

void Capsule::setHeight(Real height)
{
mCapsuleShape->setHeight(height);
}

Real Capsule::getRadius() const
{
return mCapsuleShape->getRadius();
}

Real Capsule::getHeight() const
{
return mCapsuleShape->getHeight();
}

SimpleCapsule Capsule::getWorldCapsule()
{
SimpleCapsule out;
if (mCapsuleShape)
{
NxCapsule capsule;
mCapsuleShape->getWorldCapsule(capsule);
return SimpleCapsule(capsule);
}
return out;
}

void Capsule::saveToDescription(CapsuleDescription& description)
{
NxCapsuleShapeDesc desc;
mCapsuleShape->saveToDesc(desc);
description.mDensity = desc.density;
description.mFlags.from_i(desc.shapeFlags);
description.mGroup = desc.group;
description.mGroupsMask.bits0 = desc.groupsMask.bits0;
description.mGroupsMask.bits1 = desc.groupsMask.bits1;
description.mGroupsMask.bits2 = desc.groupsMask.bits2;
description.mGroupsMask.bits3 = desc.groupsMask.bits3;
desc.localPose.getRowMajor44(description.mLocalPose.ptr());
description.mMass = desc.mass;
description.mMaterial = desc.materialIndex;
description.mNonInteractingCompartmentTypes = desc.nonInteractingCompartmentTypes;
description.mSkinWidth = desc.skinWidth;

description.mRadius = mCapsuleShape->getRadius();
description.mHeight = mCapsuleShape->getHeight();
}

String Capsule::to_s() const
{
return String("Capsule");
}



} // namespace NxOgre

in the cpp file there is also this one, intelisense shows only that one. what's with the old one? have the 1.6 version ;)
i havent got any issues at compiling nxogre, i can init nxogre.

EDIT:
i think it will be better if i leave this here for future nxogre 1.6 deutrius users
sample 101.cpp

Critter::BodyDescription bodyDescription;
bodyDescription.mMass = 40.0f; // Set the mass to 40kg.

// Finally create the body.
mBody = mRenderSystem->createBody(NxOgre::BoxDescription(1,1,1), NxOgre::Vec3(0,5,0), "cube.1m.mesh", bodyDescription);


betajean: i have a shell account with www server. I would like to make some good documentation for nxogre on the summer break, but we have to discuss it over skype :) i need to know the architecture.

betajaen

13-01-2011 08:41:49

Actually this is common knowledge, and the one of the first things you learn when using NxOgre. It doesn't need to be here.

mironix

13-01-2011 14:28:30

yeah i know , btw betajean what's that matrix44 for? rotation?

mBody = nxrender->createBody(NxOgre::CapsuleDescription(boneRadius,boneLength),NxOgre::Matrix44::IDENTITY,"cube.1m.mesh",bodyDescription);

EDIT:
K found the constructor of matrix44(vec3,quat)

betajaen

13-01-2011 15:48:36

Position and Orientation, yes.

mironix

13-01-2011 16:37:46


template<typename xyz_vector_class>
inline Vec3 operator=(const xyz_vector_class& other)
{
set(other.x, other.y, other.z);
return *this;
}


somtimes i get an error


Error 22 error C2228: left of '.x' must have class/struct/union d:\nxogre2\nxogre\sdk\nxogrevec3.h 76 SummonerFighter
Error 23 error C2228: left of '.y' must have class/struct/union d:\nxogre2\nxogre\sdk\nxogrevec3.h 76 SummonerFighter
Error 24 error C2228: left of '.z' must have class/struct/union d:\nxogre2\nxogre\sdk\nxogrevec3.h 76 SummonerFighter


what's that about?
EDIT:
ANWSER

you have used a scalar, not a vector, it's a template class.

betajaen

13-01-2011 17:14:02

As much as I appreciate you posting here.

You don't need to write down every single problem you have with NxOgre then quickly find out why.

mironix

13-01-2011 17:19:37

i think that will help start every newbie faster with this type of frequent newbie errors, i will post it on wikierrors, my friend's project :) then i delete all posts and leave a link. i promise :) ignore me for a while :)

betajaen

13-01-2011 17:23:57

No, please stop.

Your giving out wrong information.

mironix

13-01-2011 17:25:22

ok delete this topic :)

betajaen

13-01-2011 17:28:13

Look, I don't mind you posting here. But you've been here for five minutes and answering posts, and giving out advice. At lease use NxOgre for a while before helping out.