I'd like to design a system in which I click on a button, and a 3D object is generated, which attaches itself to the cursor(within a limited bound in front of the camera), and from which I can then place that object within my scene, via drag and drop...
From there, I'd like to be able to have different types of object behavior, depending on where I place them. If I drop an Anchor object, it stays put. If I drop a satellite object near an anchor object (within a certain radius, say), I want that object to move parallel to the ground to 90 degrees north of the Anchor. When I drop another object near those, I want both satellites to orient 180 degrees from each other... with 3 satellites, they should form a triangle, sliding into place, and so on, forming up in equidistant orbits around anchor objects. (physics and virtual springs? or is there an easy way to do this?)
Once I have this done, I think I'll be able to start working on my main project, so I know I have a lot to learn.
So, to break it down, I need to learn how dynamically load and unload objects, how to create the behavior of the satellites around the anchor, and so on. My question is this:
Could someone kindly break up my mini-plan into terms that I could use for searches on the forum? I ran into a syntax wall, I guess, and my searches aren't turning up much good information.
For example, I know that selecting a 3D object is called picking. What would the behaviors I want to design be called? And so on.
I really appreciate it!
Need some help, very basic level stuff.
Re: Need some help, very basic level stuff.
What about smgr->addAnimatedMeshSceneNode() and drop()?JRowe47 wrote:I need to learn how dynamically load and unload objects
-
- Posts: 157
- Joined: Tue Mar 20, 2007 8:30 am
No, bad...never drop() anything unless it was made using create, for example createDevice(). For a scene node, like in your example, use remove() (not sure how correct that it, someone correct me if I'm wrong)What about smgr->addAnimatedMeshSceneNode() and drop()?
Ok, lets start at the top shall we?
To attach an object to the mouse cursor you'll need to convert 2D screen co-ordinates to 3D world co-ordinates. I'm doing something like this in my game, so the command to use is this one:
Code: Select all
core::line3df line = ISceneCollisionManager->getRayFromScreenCoordinates(core::position2d<s32>(x, y), ICameraSceneNode);
To create objects with different behaviour, make sure the program knows what button you click on, then when you complete the drag and drop tell it to apply that behaviour to the scene node. Anchor objects is simple, just put the scene node at a certain position. For the satellites, I've never done anything like this, but you might be able to use this command, just look it up in the documentation for more info:
Code: Select all
scene::ISceneManager::createFlyCircleAnimator()
Tell me what you cherish most. Give me the pleasure of taking it away.