Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 20 Aug 2009
Offline Last Active Today, 12:47 PM

Posts I've Made

In Topic: lame question how to delete something from vector

30 August 2015 - 03:25 PM

Do you mean deleting by value instead of index? So, something like

std::vector<float> values = {1.41f, 3.14f, 42.0f}; //Initialize vector with some values

for(float v : values)
    std::cout << v << std::endl; 

And it would say 3.14f and 42.0f?


For that, you could just run through the vector and delete the value:

for(auto it = values.begin(); it != values.end(); it++)
    if(*it == 1.41f) { 

Or, include <algorithm> and do this:

values.erase(std::find(values.begin(), values.end(), 1.41f);

std::find returns the iterator to the first item in the range ( values.begin(), values.end() ) that compares equal to the value (1.41f) that you provide.


Please note that in the example, I use floats, so it is hard to confuse the value with an index. However, comparing floats simply with the == operator is usually not optimal. That is an entirely different topic, I advise you to look it up.

In Topic: Curved and sloped 3D tiles

05 August 2015 - 03:57 AM

You could even apply some kind of transformation afterwards. Look at Warcraft3's system, for example. The terrain is certainly composed of tiles ( mostly flat tiles, cliffs at certain places ). However, you can also apply height to them. Basically, you have a mesh composed of tiles, and then offset the vertices' z values by a heightmap. 

Sorry, I can't provide an image right now, but if you search a bit, you will definitely find some. 


Also, it's worth noting that you can do any sort of transformation you wish. Just provide the editor with some way to control that transform, and preview it. ( Assuming you have some kind of level editor ) 

In Topic: ASCENT Co-op Platform Game - Moving to 3D - Feedback appreciated

31 July 2015 - 04:21 PM

As for the visuals, I feel like most of the specular is unnecessary. It makes the whole thing feel artificial and unsettling. At least, I don't like looking at this kind of artificial for too long.

In Topic: Default Keyboard Controls

22 June 2015 - 02:17 PM

G is really awkward to reach when your fingers are on WASD. I'd suggest moving it to F, or using Q and E for your frequent actions ( like reload and grenades )

In Topic: Finding Camera Front

10 August 2014 - 11:59 PM

Assume Y+ points forward and Z+ points upwards, and you have your rotations in radians ( I see you already convert them, so that won't be an issue ).

In this scenario, rx would mean the pitch, rz would mean the yaw, and ry would mean the roll. Now, to get the vector (vx,vy,vz) facing in the camera's direction:

vx =  cos(rz) * sin(rx);
vy = -sin(rz) * sin(rx);
vz =  cos(rx);

vy is negated so increasing rz would rotate counter-clockwise. You could just not-negate it if that's not the desired behaviour.

As you can see, ry ( the roll ) is not included - a vector is just a direction, but not a full transformation, so it doesn't include it.