How move entity in version 1.10 ?
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
How move entity in version 1.10 ?
Hello,
How in Ogre 1.10 move entity ?
How in Ogre 1.10 move entity ?
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
hi! you are not suppose to move entities, entities just hold rendering information, SceneNodes are the ones that holds transform information hence you can move it. So, attach your entity to the sceneNode and the call sceneNode->setPosition(x,y,z)
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
Ok, thanks man, now i have problem, how to move camera and ninja.mesh
This is my code , i would move key up, down, left, right :
This is my code , i would move key up, down, left, right :
Code: Select all
Root* root;
SceneManager* scnMgr;
SceneNode* camNode;
Camera* cam;
Entity* ninja;
SceneNode* ninjaNode;
void TutorialApplication::setup()
{
RTShader::ShaderGenerator* shadergen;
// do not forget to call the base first
ApplicationContext::setup();
addInputListener(this);
// get a pointer to the already created root
root = getRoot();
scnMgr = root->createSceneManager();
// register our scene with the RTSS
shadergen = RTShader::ShaderGenerator::getSingletonPtr();
shadergen->addSceneManager(scnMgr);
// -- tutorial section start --
//! [cameracreate]
camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
cam = scnMgr->createCamera("myCam");
//! [cameracreate]
//! [cameraposition]
camNode->setPosition(0, 200, 200); // 200, 300, 400
camNode->lookAt(Vector3(0, 150, 0), Node::TransformSpace::TS_WORLD);
//! [cameraposition]
//! [cameralaststep]
cam->setNearClipDistance(5);
camNode->attachObject(cam);
//! [cameralaststep]
//! [addviewport]
Viewport* vp = getRenderWindow()->addViewport(cam);
//! [addviewport]
//! [viewportback]
vp->setBackgroundColour(ColourValue(0, 0, 0));
//! [viewportback]
//! [cameraratio]
cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
//! [cameraratio]
//! [ninja]
ninja = scnMgr->createEntity("ninja.mesh");
ninja->setCastShadows(true);
ninjaNode = scnMgr->getRootSceneNode()->createChildSceneNode();
ninjaNode ->attachObject(ninja);
//! [ninja]
//! [plane]
Plane plane(Vector3::UNIT_Y, 0);
//! [plane]
//! [planedefine]
MeshManager::getSingleton().createPlane(
"ground",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane,
1500, 1500, 20, 20,
true,
1, 5, 5,
Vector3::UNIT_Z);
//! [planedefine]
//! [planecreate]
Entity* groundEntity = scnMgr->createEntity("ground");
scnMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
//! [planecreate]
//! [planenoshadow]
groundEntity->setCastShadows(false);
//! [planenoshadow]
//! [planesetmat]
groundEntity->setMaterialName("Examples/Rockwall");
//! [planesetmat]
//! [lightingsset]
scnMgr->setAmbientLight(ColourValue(0, 0, 0));
scnMgr->setShadowTechnique(ShadowTechnique::SHADOWTYPE_STENCIL_MODULATIVE);
//! [lightingsset]
//! [spotlight]
Light* spotLight = scnMgr->createLight("SpotLight");
//! [spotlight]
//! [spotlightcolor]
spotLight->setDiffuseColour(0, 0, 1.0);
spotLight->setSpecularColour(0, 0, 1.0);
//! [spotlightcolor]
//! [spotlighttype]
spotLight->setType(Light::LT_SPOTLIGHT);
//! [spotlighttype]
//! [spotlightposrot]
spotLight->setDirection(Vector3::NEGATIVE_UNIT_Z);
SceneNode* spotLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
spotLightNode->attachObject(spotLight);
spotLightNode->setDirection(-1, -1, 0);
spotLightNode->setPosition(Vector3(200, 200, 0));
//! [spotlightposrot]
//! [spotlightrange]
spotLight->setSpotlightRange(Degree(35), Degree(50));
//! [spotlightrange]
//! [directlight]
Light* directionalLight = scnMgr->createLight("DirectionalLight");
directionalLight->setType(Light::LT_DIRECTIONAL);
//! [directlight]
//! [directlightcolor]
directionalLight->setDiffuseColour(ColourValue(0.4, 0, 0));
directionalLight->setSpecularColour(ColourValue(0.4, 0, 0));
//! [directlightcolor]
//! [directlightdir]
directionalLight->setDirection(Vector3::NEGATIVE_UNIT_Z);
SceneNode* directionalLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
directionalLightNode->attachObject(directionalLight);
directionalLightNode->setDirection(Vector3(0, -1, 1));
//! [directlightdir]
//! [pointlight]
please, help
Light* pointLight = scnMgr->createLight("PointLight");
pointLight->setType(Light::LT_POINT);
//! [pointlight]
//! [pointlightcolor]
pointLight->setDiffuseColour(0.3, 0.3, 0.3);
pointLight->setSpecularColour(0.3, 0.3, 0.3);
//! [pointlightcolor]
//! [pointlightpos]
SceneNode* pointLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
pointLightNode->attachObject(pointLight);
pointLightNode->setPosition(Vector3(0, 150, 250));
//! [pointlightpos]
// -- tutorial section end --
}
bool TutorialApplication::keyPressed(const KeyboardEvent& evt)
{
if (evt.keysym.sym == SDLK_ESCAPE)
{
getRoot()->queueEndRendering();
}
if (evt.keysym.sym == SDLK_UP)
{
ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, 100));
}
if (evt.keysym.sym == SDLK_DOWN)
{
ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, -100));
}
return true;
}
Last edited by Rybunial on Sun Feb 11, 2018 11:30 pm, edited 1 time in total.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
I don't get much your question, you already moving your ninja when you press some buttons... I think you are not getting what you expect because you're setting the position to a fixed one (rotated by the current orientation), what you want (I guess...) is to use
or something like
and for the camera, you can also set position or translate since camNode its also a node, you just might want to work a little in the behavior you want
Also: please use the [ code ] tag for codes , its really hard to read it that way
Code: Select all
ninjaNode->translate(0,0,value)
Code: Select all
ninjaNode->setPosition( ninjaNode->getOrientation() * ( ninjaNode->getPosition() + Vector3(0, 0, value) ) );
Also: please use the [ code ] tag for codes , its really hard to read it that way
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
Thanks,
ok, i move but i dont know how turn camera and ninja. Please help
ok, i move but i dont know how turn camera and ninja. Please help
Code: Select all
if (evt.keysym.sym == SDLK_ESCAPE)
{
getRoot()->queueEndRendering();
}
if (evt.keysym.sym == SDLK_UP)
{
//value = value - 5.0f;
// ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, 100));
//ninjaNode->translate(0, 0, value);
ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, -50)));
camNode->translate(0, 0, -50);
}
if (evt.keysym.sym == SDLK_DOWN)
{
//value = value + 5.0f;
// ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, 100));
//ninjaNode->translate(0, 0, value);
//ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, -100));
ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, 50)));
camNode->translate(0, 0, 50);
}
if (evt.keysym.sym == SDLK_LEFT)
{
camNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f),
Ogre::Math::Sqrt(0.5f), 200, 200));
}
return true;
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
well, that really depends on what you want to achieve, there are many types of camera in games/3Dapps... assuming you want some kind of 3rd person, you can just attach the camera to the ninjaNode (make the camNode a child of the ninjaNode)
and then translate it someValue units behind the ninja, so it seems like the camera follows the ninja all the time
you have to do this just one time! like, right after you create all the nodes, you can also do setPosition()... if the position of a node is (0,0,0) and you call translate(0,0,someValue) just one time, its the same as if you call setPosition(0,0,someValue).
By making a node child of another node you change its coordinate system to be centered on its new parent instead of the world, so if the node is in position (0,0,someValue) it means its just someValue units i the Z axis in respect to its parent, so if you move the parent the child node will move with it and will have de same position as the parent in the world but offseted someValue units in the Z axis.
You can later do more fancy camera stuffs with some creativity.
you can control rotation via the methods setOrientation, which accepts a quaternion (look for videos about this in youtube, I like this one: https://www.youtube.com/watch?v=tzx_jHtPId4) and the methods yaw pitch and roll
Code: Select all
camNode->getParentSceneNode()->removeChild( camNode );
ninjaNode ->addChild( camNode );
Code: Select all
ninjaNode->translate(0,0,someValue)
By making a node child of another node you change its coordinate system to be centered on its new parent instead of the world, so if the node is in position (0,0,someValue) it means its just someValue units i the Z axis in respect to its parent, so if you move the parent the child node will move with it and will have de same position as the parent in the world but offseted someValue units in the Z axis.
You can later do more fancy camera stuffs with some creativity.
you can control rotation via the methods setOrientation, which accepts a quaternion (look for videos about this in youtube, I like this one: https://www.youtube.com/watch?v=tzx_jHtPId4) and the methods yaw pitch and roll
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
And now i have new problem
I write this:
i must give 200 , because ninja is too low, then i gave this code , my ninja rotate but now i cant move ninja when i press left.
i watched this film but i think im too new , do you write how routate ninja, please help
Best Regards
I write this:
Code: Select all
if (evt.keysym.sym == SDLK_LEFT)
{
ninjaNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f), Ogre::Math::Sqrt(0.5f), 200, 0));
}
i watched this film but i think im too new , do you write how routate ninja, please help
Best Regards
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
the problem is that you are not considering the current orientation when pressing the button, right now whats happening is that you press left and you set the orientation in to a certain quaternion value, then when you press left again, you set the orientation to that same value again, but since its already with that value, it does nothing.
you need to do something like this (If i recall correctly..):
(multiplication si *like* summation in quaternions, well at least the effect )
so now, when you press left again you will consider the current orientation value and "add" some more rotation in to it
and btw, an easy way to create good quaternions are like this:
with that you should get a 15 degree rotation around the Y axis
you need to do something like this (If i recall correctly..):
Code: Select all
if (evt.keysym.sym == SDLK_LEFT)
{
ninjaNode->setOrientation( ninjaNode->getOrientation() * Ogre::Quaternion(Ogre::Math::Sqrt(0.5f), Ogre::Math::Sqrt(0.5f), 200, 0) );
}
so now, when you press left again you will consider the current orientation value and "add" some more rotation in to it
and btw, an easy way to create good quaternions are like this:
Code: Select all
Ogre::Quaternion newQuat = Ogre::Quaternion( Ogre::Radian( Ogre::Degree(15).valueRadians() ), Ogre::Vector3::UNIT_Y );
ninjaNode->setOrientation( ninjaNode->getOrientation() * newQuat );
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
|Thanks,
Ok i can rotate but now i dont move , ninja go forward and back and press up , ninja go around.
Ok i can rotate but now i dont move , ninja go forward and back and press up , ninja go around.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
that's strange, movement was working before? you should be able to apply both orientation and position/translation at the same time. Dan you explain a bit more the problem? maybe show more code or a video
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
Ok this my code:
Code: Select all
class TutorialApplication
: public ApplicationContext
, public InputListener
{
public:
TutorialApplication();
virtual ~TutorialApplication();
void setup();
bool keyPressed(const KeyboardEvent& evt);
};
TutorialApplication::TutorialApplication()
: ApplicationContext("OgreTutorialApp")
{
}
TutorialApplication::~TutorialApplication()
{
}
Root* root;
SceneManager* scnMgr;
SceneNode* camNode;
Camera* cam;
Entity* ninja;
SceneNode* ninjaNode;
void TutorialApplication::setup()
{
RTShader::ShaderGenerator* shadergen;
// do not forget to call the base first
ApplicationContext::setup();
addInputListener(this);
// get a pointer to the already created root
root = getRoot();
scnMgr = root->createSceneManager();
// register our scene with the RTSS
shadergen = RTShader::ShaderGenerator::getSingletonPtr();
shadergen->addSceneManager(scnMgr);
// -- tutorial section start --
//! [cameracreate]
camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
cam = scnMgr->createCamera("myCam");
//! [cameracreate]
//! [cameraposition]
camNode->setPosition(0, 200, 200); // 200, 300, 400
camNode->lookAt(Vector3(0, 150, 0), Node::TransformSpace::TS_WORLD);
//! [cameraposition]
//! [cameralaststep]
cam->setNearClipDistance(5);
camNode->attachObject(cam);
//! [cameralaststep]
//! [addviewport]
Viewport* vp = getRenderWindow()->addViewport(cam);
//! [addviewport]
//! [viewportback]
vp->setBackgroundColour(ColourValue(0, 0, 0));
//! [viewportback]
//! [cameraratio]
cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
//! [cameraratio]
//! [ninja]
ninja = scnMgr->createEntity("ninja.mesh");
ninja->setCastShadows(true);
ninjaNode = scnMgr->getRootSceneNode()->createChildSceneNode();
ninjaNode ->attachObject(ninja);
//! [ninja]
//! [plane]
Plane plane(Vector3::UNIT_Y, 0);
//! [plane]
//! [planedefine]
MeshManager::getSingleton().createPlane(
"ground",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane,
1500, 1500, 20, 20,
true,
1, 5, 5,
Vector3::UNIT_Z);
//! [planedefine]
//! [planecreate]
Entity* groundEntity = scnMgr->createEntity("ground");
scnMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
//! [planecreate]
//! [planenoshadow]
groundEntity->setCastShadows(false);
//! [planenoshadow]
//! [planesetmat]
groundEntity->setMaterialName("Examples/Rockwall");
//! [planesetmat]
//! [lightingsset]
scnMgr->setAmbientLight(ColourValue(0, 0, 0));
scnMgr->setShadowTechnique(ShadowTechnique::SHADOWTYPE_STENCIL_MODULATIVE);
//! [lightingsset]
//! [spotlight]
Light* spotLight = scnMgr->createLight("SpotLight");
//! [spotlight]
//! [spotlightcolor]
spotLight->setDiffuseColour(0, 0, 1.0);
spotLight->setSpecularColour(0, 0, 1.0);
//! [spotlightcolor]
//! [spotlighttype]
spotLight->setType(Light::LT_SPOTLIGHT);
//! [spotlighttype]
//! [spotlightposrot]
spotLight->setDirection(Vector3::NEGATIVE_UNIT_Z);
SceneNode* spotLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
spotLightNode->attachObject(spotLight);
spotLightNode->setDirection(-1, -1, 0);
spotLightNode->setPosition(Vector3(200, 200, 0));
//! [spotlightposrot]
//! [spotlightrange]
spotLight->setSpotlightRange(Degree(35), Degree(50));
//! [spotlightrange]
//! [directlight]
Light* directionalLight = scnMgr->createLight("DirectionalLight");
directionalLight->setType(Light::LT_DIRECTIONAL);
//! [directlight]
//! [directlightcolor]
directionalLight->setDiffuseColour(ColourValue(0.4, 0, 0));
directionalLight->setSpecularColour(ColourValue(0.4, 0, 0));
//! [directlightcolor]
//! [directlightdir]
directionalLight->setDirection(Vector3::NEGATIVE_UNIT_Z);
SceneNode* directionalLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
directionalLightNode->attachObject(directionalLight);
directionalLightNode->setDirection(Vector3(0, -1, 1));
//! [directlightdir]
//! [pointlight]
Light* pointLight = scnMgr->createLight("PointLight");
pointLight->setType(Light::LT_POINT);
//! [pointlight]
//! [pointlightcolor]
pointLight->setDiffuseColour(0.3, 0.3, 0.3);
pointLight->setSpecularColour(0.3, 0.3, 0.3);
//! [pointlightcolor]
//! [pointlightpos]
SceneNode* pointLightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
pointLightNode->attachObject(pointLight);
pointLightNode->setPosition(Vector3(0, 150, 250));
//! [pointlightpos]
// -- tutorial section end --
camNode->getParentSceneNode()->removeChild(camNode);
ninjaNode->addChild(camNode);
}
float value = 0.0f;
Ogre::Quaternion newQuat = Ogre::Quaternion(Ogre::Radian(Ogre::Degree(15).valueRadians()), Ogre::Vector3::UNIT_Y);
bool TutorialApplication::keyPressed(const KeyboardEvent& evt)
{
if (evt.keysym.sym == SDLK_ESCAPE)
{
getRoot()->queueEndRendering();
}
if (evt.keysym.sym == SDLK_UP)
{
//value = value - 5.0f;
// ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, 100));
//ninjaNode->translate(0, 0, value);
ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, -50)));
//camNode->translate(0, 0, -50);
}
if (evt.keysym.sym == SDLK_DOWN)
{
//value = value + 5.0f;
// ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, 100));
//ninjaNode->translate(0, 0, value);
//ninjaNode->setPosition(ninjaNode->getOrientation() * Vector3(0, 0, -100));
ninjaNode->setOrientation(ninjaNode->getOrientation());
ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, 50)));
//camNode->translate(0, 0, 50);
}
if (evt.keysym.sym == SDLK_LEFT)
{
//ninjaNode->setOrientation(Ogre::Quaternion(50, (ninjaNode->getOrientation() *ninjaNode->getPosition().x), (ninjaNode->getOrientation() *ninjaNode->getPosition().y), (ninjaNode->getOrientation() *ninjaNode->getPosition().z)));
//ninjaNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f),
// 0, 200, Ogre::Math::Sqrt(0.5f)));
//ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, 0)));
//ninjaNode->setOrientation(Quaternion(Degree(90), ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(1, 0, 0))));
// ninjaNode->setOrientation(aroundPos.getRotationTo(targetPos));
// ninjaNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f), Ogre::Math::Sqrt(0.5f), 200, 0));
// ninjaNode->rotate(Vector3::UNIT_Y, Degree(90```));
ninjaNode->setOrientation(ninjaNode->getOrientation() * newQuat );
}
if (evt.keysym.sym == SDLK_RIGHT)
{
// ninjaNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f),
// Ogre::Math::Sqrt(0.5f), 200, 0));
//ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(-50, 0, 0)));
}
return true;
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
(I removed the commented lines...)
I am not sure what the problem is... might be that this events are called just one time.. when you just pressed the button? maybe you expect the node to move all the time you are holding the button, and stop moving when you release?
pressing UP seems to be moving the ninja -50 units in the direction of the orientation of the nodeCode: Select all
if (evt.keysym.sym == SDLK_UP) { ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, -50))); }
pressing down seems to be doing the same but with 50 unitsCode: Select all
if (evt.keysym.sym == SDLK_DOWN) { ninjaNode->setOrientation(ninjaNode->getOrientation()); <<<<<<<<THIS LINE DOES NOTHING, sets the orientation value from the current one ninjaNode->setPosition(ninjaNode->getOrientation() * (ninjaNode->getPosition() + Vector3(0, 0, 50))); }
pressing left seems to be rotating the node 15 degrees in the Y axisCode: Select all
if (evt.keysym.sym == SDLK_LEFT) { ninjaNode->setOrientation(ninjaNode->getOrientation() * newQuat ); }
and pressing right does nothing, should this do the oposite of left? rotate -15 in the Y axis (which would be the same as rotating 15 in the negative Y axis)Code: Select all
if (evt.keysym.sym == SDLK_RIGHT) { }
I am not sure what the problem is... might be that this events are called just one time.. when you just pressed the button? maybe you expect the node to move all the time you are holding the button, and stop moving when you release?
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
My problem is , when i press left and next press UP , ninja turns around.
-
- Gnoblar
- Posts: 16
- Joined: Sun Jan 28, 2018 4:10 pm
Re: How move entity in version 1.10 ?
hello, first thanks for your replay,
Simple, I started learn ogre.
i need simple code to run my ninja to left , right, up, down and rotate , I know is simple but i dont find this in yours documentation. Please give me full simple code to move my ninja. to continue learning.
Please help
Simple, I started learn ogre.
i need simple code to run my ninja to left , right, up, down and rotate , I know is simple but i dont find this in yours documentation. Please give me full simple code to move my ninja. to continue learning.
Please help
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How move entity in version 1.10 ?
Hello!
I already gave you some code, not sure what is wrong in your case, can you post your code and a video/gif showing your problem?.
Also check the Sinbad sample, in that sample you can move the character and also use the sword, use the code from that =D
cheers!
I already gave you some code, not sure what is wrong in your case, can you post your code and a video/gif showing your problem?.
Also check the Sinbad sample, in that sample you can move the character and also use the sword, use the code from that =D
cheers!