@wilco2009 well here I am again with not much success with atan2. I am getting values but they are very small. rotation.x = atan2(player_direction.y,player_position.z); rotation.y = atan2(player_direction.x,player_position.z); rotation.z = atan2(player_direction.x,player_position.y); I tried multiplying the rotation values by 180 but that still did not result in constant rotation. Doby owen - Coding
^ I am currently rotating the car in relation to itself by a small amount (40 degrees) on the y axis. No pitch or roll yet but I will probably try to apply those 1 at a time.by owen - Coding
Got distracted a bit but I am back now. I'm confused, how do you use this arctan function? since I need 3 angles to rotate the object matrix using; GRRLIB_ObjectViewRotate( angle1,angle2, angle3); If I need the object at player_position to "look at" the player_direction. For example if player_position = { 5, 5, 5 } and player_direction={ -10,50,100}. angle1=atan2(player_direction.x,by owen - Coding
I personally haven't used the nunchuk much but your code doesn't look hard to implement.by owen - Coding
@tueidj It would be like test for a person playing with a broken n64 joystick its either not going to work or the person would have to adjust himself to accomodate. but I see what you are saying, right now I can only test the optimum situation (standard classic controller, nunchuk) and it does fall back to the d-pad if all else fails. @Titmouse yeah the person keeps swapping out continuoslby owen - Coding
Such a funny coincidence that I was working on the very same problem all day today! (wasted the whole day). Now here is my version. This will generate a float value between -1,0 and 1 (Because I just love working with polar numbers). Most times it doesn't reach absolute 1 or -1 but it doesn't really matter as long as you are using the value in a analog fashion (e.g speed * val).by owen - Coding
^ yes the method works but I have to continuously store the value of "angle" as I turn the player. It would be nicer if I could find the angle between the player_position and the player_direction by making a right angled triangle ( like this )by owen - Coding
Quotewilco2009Hi Owen, I can't understand your question. You are trying to find the angle to draw the player car? Yes. Basically I want to rotate the model so that it faces the player_direction. It is easy to do with the camera because the camera has a look at parameter but I don't know how to do it with a model.by owen - Coding
Good day again. I have a related problem. The code so far works fine. I usually use one of the grrlib functions such as GRRLIB_ObjectView to scale and rotate before I draw my model, those are doing thier own mtx stuff. Now I am trying to determine what angle to rotate the player_model so that it faces the player_direction. I would past the angle to GRRLIB_ObjectView(). Any suggestions onby owen - Coding
@wilco2009 Sure I will have a demo and make the game open-source because I am sure that I will not be able to do all the code by myself. Since there are only 2 racing games on wiibrew; then it must be a sign that they are hard to make :)by owen - Coding
@wilco2009 Ahha! It works now, surprisingly and confusingly well. Thanx for your help. This matrix stuff is like magic. I had already had a way to move my point of view but your matrix version has less lines of code. I know I will have problems when I try to add the other stuff like momentum, gravity and the wheels of the car but I am worrying about those things as yet. I will probably use iby owen - Coding
@wilco2009 the player_direction is now rotating around (0,0,0) and the player position has no effect on it. :(by owen - Coding
Thank you, I will test it in 1 hour when I get home.by owen - Coding
@wilco2009 this version works as expected but it only works if player_position is (0,0,0). If I change the player position the player_direction flies off in one direction. I really don't know why. The player_direction should be rotating around the center point ( player_position ) no matter where it is located. here is the function so far; guVector rotate_to_angle( float angle, gby owen - Coding
@tueidj you mtx transformation seems to be rotating around itself and I don't know how to merge the player position into the equation. @wilco2009 doesn't really work. It produces the same point everytime an angle is passed to the function. And if I try to increase the angle from 30 to 360 it rotates around player position in a figure 8.by owen - Coding
@wilco2009 yeah its basically a look at vector for the player. I will try the code you posted and see what happens. thanx.by owen - Coding
@wilco2009 At the moment when I turn I do not move the position vector. I simply want to move the direction vector to another location which is a few degrees to the right or left on the perimeter surrounding the player_position. I think its more of a 2 dimensional rotation but I don't know a simple way to calculate the new point.by owen - Coding
@tueidj sorry about that player_direction is a point in space which the player position is constantly moving towards. yeah its very "hackish" but its the only way I know how to do it now. I'm not on competent with the matrix programming as yet. Unless you have some simple functions that I can drop into my code without forcing me to enter the matrix revolution.by owen - Coding
@wilco2009 I convert the degrees to rads. Yes the vector rotates on the Y axis but I don't understand your formula. Is it the same thing as doing; angle=DegToRad(60); player_direction.y = player_direction.y; player_direction.z' = player_position.z*cos(angle)-player_position.x*sin(angle); player_direction.x' = player_position.z*sin(angle)+player_position.x*cos(angle);by owen - Coding
the guVector is basically a float[3]. I haven't thought about momentum or velocity as yet. I could keep the direction normalized but it would mean having to mess around with the Mtx functions. Why are you doing; orig_direction = player_direction? The way I planned is to have the player_direction change relative to the player_position. As in the player_direction is a point rotated aroby owen - Coding
So I'm started coding up a simple 3d racing game and I am trying to figure out how to turn. I have 2 vectors; float player_position[3] = {0,0,0}; float player_direction[3] = {0,0,1000}; I want to change the player_direction vector by an angle example 60 degrees to the right or left of its current position. Whats the simplest way to calculate the new point in c?by owen - Coding
Since there are only 2 racing games on wiibrew. I figure there is probably a reason why there aren't very many of them. Anybody have any links to information on how to code a quick and dirty 3d racing game?by owen - Ideas, requests
I don't think people are going to stop asking this question as silly as it may seem. Why would you buy a console that is clearly gimped? then to make matters worst try to emulate something that has the best hardware backward compatibility of all the consoles.by owen - Homebrew General
Ico is a puzzle game with similar graphical art style (mostly post processing) where you lead a girl through a castle - its just as good but in a different way than shadow. The castle is the enemy instead of the colossi. I just start playing through the ps2 stuff since its pretty cheap now and was impressed with how big and technically complicated the games are shadows, bloom lighting, collisioby owen - Coding
Just finished playing Ico for the first time on PS2 the other day and though the camera sucked but I really loved the feel of the whole world and the environment. I got to reading up about it and found PDF making of its sister game; ( some of you may find it a long but interesting read on the tech stuff behind the game )by owen - Coding
I think this is perfect opportunity to duct-tape a gamecube to the new wii and the whole "wii-is-2-gamecubes" would finally make sense.by owen - Ideas, requests
@SifJar suppose you put oil on the disc and grease it up? yeah, probably won't work either.by owen - Ideas, requests
Disc could be scratched. This usually happens with mario kart. If the disc is scratched at a certain part it may cause it to stop working if you race on certain tracks. Try to remember where you were before you got the error and replay it to see if it is a problem with the disc.by owen - Offtopic
It only plays snd files encoded in certain format (which is really annoying). The instructions are on its page; you will have to download goldwave to convert the files to the *.snd format.by owen - Coding
I suggest you sell it ASAP, even if you could, you still can't plug the controller into it and what is the gamecube without its weird controllers?by owen - Ideas, requests