Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


flammable

Member Since 11 Mar 2009
Offline Last Active Oct 18 2014 01:21 PM

Posts I've Made

In Topic: How to do picking with mouse click on nodes in Irrlicht

02 February 2014 - 04:20 AM

Hey,

 

The simplest method is using: ISceneCollisionManager::getSceneNodeFromScreenCoordinatesBB

This method only takes bounding boxes into consideration though, if you need more precision you should probably use

 line3d<f32> ray = colmgr->getRayFromScreenCoordinates(device->getCursorControl()->getPosition(), camera);

This returns a ray which goes though the camera and points to where the cursor is pointing, then use:

ISceneCollisionManager::getSceneNodeAndCollisionPointFromRay

to find the first scene node intersecting this ray

 

links:

http://irrlicht.sourceforge.net/forum/viewtopic.php?t=38725

http://irrlicht.sourceforge.net/docu/classirr_1_1scene_1_1_i_scene_collision_manager.html


In Topic: How to send notification in Facebook API!

22 August 2013 - 03:47 AM

You might want to have a look at this thread: http://stackoverflow.com/questions/12266593/how-to-use-new-client-side-facebook-notifications-api


In Topic: Avoiding unnecessary recalculation

07 August 2013 - 07:29 AM

Thanks for your replies. That's alot of usefull information. Seperating dynamic and static nodes is something I'm going to work on.

 

Thank you guys!


In Topic: 2 c++ problems

09 August 2011 - 02:52 PM

Thanks for the quick replies :D.
panic your solution worked and my second problem is now solved :)
NightCreature83 your post was a big ohhhh... "I should have known" moment, I understand what the problem is know, guess I keep things as they are now.

Thanks again.

In Topic: Inheritance and base class pointers

31 August 2010 - 10:55 PM

I don't know how your actual design looks like but the most simple solution would be to include sortval in your base class (this is probably where you are looking for).
class A
{
public:
string Name;
int Sortval;

// You could also make a virtual set and get methods:
virtual int getSortval() {return Sortval;}
virtual void setSortval(int sortval) {Sortval = sortval;}
};

class B : public A{
public:
};

class C : public A{
public:
};

A* Test = new C;
std::cout << Test->Sortval << '\n';






I hope this solution fits in your design (but if you want to sort your container every value needs to contain a sortval, so probably yes).

Another solution (which is I think more complicated than necessary) is to create a struct which holds a sortval and a pointer to the base class, like this:

struct Value // or a class doesn't matter
{
int Sortval;
A* Pointer;
};

Value First = {1, new B};
Value Second = {2, new C};







But I would definitely prefer the first solution.

PARTNERS