3д кола завои |
Здравейте ( Вход | Регистрация )
3д кола завои |
![]()
Коментар
#1
|
|
![]() Новодошъл ![]() Група: Потребител Коментари: 31 Регистриран: 03.10.09 Град: България,Пазарджик Потребител № 1505 ![]() |
Искам да попитам в момента само съм направил колата да върви напред и назад , но как да направя да завива реално (смисъл като дам на ляво да завива на ляво)
|
|
|
![]() |
![]()
Коментар
#2
|
|
![]() Засмян тъпоъгълник :D ![]() Група: Администратор Коментари: 1790 Регистриран: 21.07.08 Град: Това е място, населено с много хора. FPS: 60 Потребител № 1116 ![]() |
нещо такова:
Цитат Realize that rotation and scaling are with respect to the origin of the world, not with respect to the object that is to be drawn. If the object is not at the origin it will also move to a different place, which is not what we want. So to e.g. rotate an object over its own x-axis, we must first translate it to the origin, next rotate it, and finally translate it back to its position. This is what the functions to add transformations are for.
The following examples might explain this better. Assume we have a sprite spr that we want to draw at position (100,100,10). We can use the following code to do this { d3d_transform_set_translation(100,100,10); draw_sprite(spr,0,0,0); d3d_transform_set_identity(); } Note that because we use a translation we should now draw the sprite at position (0,0). (This assumes the current instance has a depth of 0! If you are not sure, first set the depth.) If we would use this in our first person shooter we would not see the sprite. The reason is that it is still parallel to the xy-plane. We want to rotate it over 90 degrees along the x-axis (or y-axis). So we need to add a rotation. Remember the order: we must first rotate the sprite and then translate it. So we can use the following code. { d3d_transform_set_identity(); d3d_transform_add_rotation_x(90); d3d_transform_add_translation(100,100,10); draw_sprite(spr,0,0,0); d3d_transform_set_identity(); } -------------------- Цитат Пешо: 4:53:46 Я недейти са карайти тука че да ни ва зашливйъ |
|
|
![]() ![]() |
Олекотена версия | Час: 05:51:21, 04.07.25 |