OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: User:Frozenrain
View page
Source of version: 1
(current)
I am testing this and may mess up so i apologize if you see then when you don't intend to. This section is copied from "how to drive a car" page, just added ai page because I will be adding more for ai later. !!Problem You have a car and you have a point (i.e. waypoint), but you don't know how to determine to which side the car should turn to drive to the point (left or right). !!Solution Your first thought might be that solving this requires some math. But we like neither math nor magical formulas. Luckily, there is a clean, easy and simple solution. Just look at the picture: {img src="img/wiki_up/HowToDriveCar.jpg" alt="HowToDriveCar.jpg"} Left Node and Right Node are children of the car node, placed on the same distance at the left and right of the car. I.e. if the car is initially oriented along (0,0,1), left node would be (-1,0,0) and right one (1,0,0). What is the solution? Just take side which node is closer to the waypoint. No math formulas! This section is the very basic initialization of nodes on all sides. We have added an object to them so we can physicly see them to test it. //Creating Left node for AI ~pp~ mSceneMgr->getSceneNode("Car1")->createChildSceneNode("TestNodeLeft",Ogre::Vector3(0,0,2)); Entity* ent; ent = mSceneMgr->createEntity("TestLeft","mine.mesh"); mSceneMgr->getSceneNode("TestNodeLeft")->setScale(0.01,0.01,0.01); mSceneMgr->getSceneNode("TestNodeLeft")->attachObject(ent); //Creating Right Node for AI mSceneMgr->getSceneNode("Car1")->createChildSceneNode("TestNodeRight",Ogre::Vector3(0,0,-2)); ent = mSceneMgr->createEntity("TestRight","mine.mesh"); mSceneMgr->getSceneNode("TestNodeRight")->setScale(0.01,0.01,0.01); mSceneMgr->getSceneNode("TestNodeRight")->attachObject(ent); //Creating Front Node for AI mSceneMgr->getSceneNode("Car1")->createChildSceneNode("TestNodeFront",Ogre::Vector3(-3,0,0)); ent = mSceneMgr->createEntity("TestFront","mine.mesh"); mSceneMgr->getSceneNode("TestNodeFront")->setScale(0.01,0.01,0.01); mSceneMgr->getSceneNode("TestNodeFront")->attachObject(ent); //Creating Back node for AI mSceneMgr->getSceneNode("Car1")->createChildSceneNode("TestNodeBack",Ogre::Vector3(2,0,0)); ent = mSceneMgr->createEntity("TestBack","mine.mesh"); mSceneMgr->getSceneNode("TestNodeBack")->setScale(0.01,0.01,0.01); mSceneMgr->getSceneNode("TestNodeBack")->attachObject(ent); ~/pp~ I will be adding more later as I figure out ai for avoidig collisions, attacking an apponent and other things.
Search by Tags
Search Wiki by Freetags
Latest Changes
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
Critter AI
Mogre Add-ons
MOGRE
Mogre MyGUI wrapper
MOGRE Editable Terrain Manager
...more
Search
Find
Advanced
Search Help
Online Users
18 online users