Re: Calculating the angle of a point in relation to another January 14, 2012 04:59PM | Registered: 13 years ago Posts: 87 |
Re: Calculating the angle of a point in relation to another January 14, 2012 08:24PM | Registered: 13 years ago Posts: 363 |
Re: Calculating the angle of a point in relation to another January 18, 2012 03:45AM | Registered: 13 years ago Posts: 363 |
Re: Calculating the angle of a point in relation to another January 18, 2012 07:31PM | Registered: 13 years ago Posts: 87 |
Re: Calculating the angle of a point in relation to another January 18, 2012 07:40PM | Registered: 13 years ago Posts: 363 |
Quote
wilco2009
Hi Owen,
I can't understand your question.
You are trying to find the angle to draw the player car?
Re: Calculating the angle of a point in relation to another January 19, 2012 08:49AM | Registered: 13 years ago Posts: 87 |
GRRLIB_ObjectViewBegin(); GRRLIB_ObjectViewRotate(0,angle,0); GRRLIB_ObjectViewTrans(player_position.x,player_position.y,player_position.z); GRRLIB_ObjectViewEnd(); GRRLIB_DrawCube(1.0, true, 0xFFFFFFFF);
Re: Calculating the angle of a point in relation to another January 20, 2012 10:08PM | Registered: 13 years ago Posts: 363 |
Re: Calculating the angle of a point in relation to another January 20, 2012 11:10PM | Registered: 13 years ago Posts: 87 |
Re: Calculating the angle of a point in relation to another January 23, 2012 08:06PM | Registered: 16 years ago Posts: 384 |
Re: Calculating the angle of a point in relation to another January 23, 2012 11:28PM | Moderator Registered: 15 years ago Posts: 686 |
Re: Calculating the angle of a point in relation to another January 26, 2012 05:53PM | Registered: 13 years ago Posts: 363 |
angle1=atan2(player_direction.x, player_position.x); angle2=atan2(player_direction.y, player_position.y); angle3=atan2(player_direction.z, player_position.z);
Re: Calculating the angle of a point in relation to another January 26, 2012 08:35PM | Registered: 13 years ago Posts: 87 |
Re: Calculating the angle of a point in relation to another January 28, 2012 12:10PM | Registered: 13 years ago Posts: 99 |
// suffers from gimbal lock - but works if you keep within the limits of matrix rotation) guMtxRotRad(Model,'y', yaw) ; // rotate about a singlew axis guMtxRotRad(mat2,'x', pitch ); guMtxRotRad(mat3,'z', roll) ; guMtxConcat(mat3,Model,Model); guMtxConcat(mat2,Model,Model); guMtxScaleApply(Model,Model,0.18f,0.18f,0.18f); // Scale it down guMtxTrans(mat, 35,12, -450); // translate = move it guMtxConcat(mat,Model,Model); // concat, i.e. Matrix multiplication - create new matrix from the pair guMtxConcat(m_pWii->GetCamera()->GetcameraMatrix(),Model,Model); // ready for render, i.e setup thing like GX_LoadPosMtxImm with the Model and render
Re: Calculating the angle of a point in relation to another January 28, 2012 01:54PM | Registered: 13 years ago Posts: 363 |
Re: Calculating the angle of a point in relation to another January 29, 2012 05:00PM | Registered: 13 years ago Posts: 363 |
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);
Re: Calculating the angle of a point in relation to another January 29, 2012 11:01PM | Registered: 13 years ago Posts: 87 |
Re: Calculating the angle of a point in relation to another January 31, 2012 10:25PM | Registered: 13 years ago Posts: 363 |
rotation.x = atan2( player_position.y, player_direction.z) * 180 / M_PI; rotation.y = atan2( player_position.x, player_direction.z) * 180 / M_PI; rotation.z = atan2( player_position.x, player_direction.y) * 180 / M_PI;
Re: Calculating the angle of a point in relation to another February 01, 2012 03:57PM | Registered: 13 years ago Posts: 5 |
a = (ax, ay, az)T and b = (bx, by, bz)T
dot(a,b)=|a| |b| cos(theta)
|a| = sqrt( ax² + ay² + az²)
=>dot(a,b)=|a| |b| cos(theta) <=> cos(theta) = dot(a,b) / (|a| * |b|) => theta = arccos[dot(a,b) / (|a| * |b|)]
f32 guVecDotProduct (guVector *a, guVector *b)
Re: Calculating the angle of a point in relation to another February 01, 2012 07:25PM | Registered: 13 years ago Posts: 363 |
Re: Calculating the angle of a point in relation to another February 01, 2012 08:14PM | Registered: 13 years ago Posts: 5 |
Quote
owen
By default the player model is always facing/looking down -z.