Jack Admin
Number of posts : 99 Registration date : 2007-07-01
| Subject: Snapshot : PANORAMIC V 0.9.25i2 Fri Apr 26, 2013 8:27 pm | |
| Snapshot : PANORAMIC V 0.9.25i2
A new snapshot is available and can be downloaded : Download snapshot
New features:
- commands for camera: CAM_PITCH A : rotates the camera around its X-axis by the angle A (degrees). CAM_TURN A : rotates the camera around its Y-axis by the angle A (degrees). CAM_ROLL A : rotates the camera around its Z-axis by the angle A (degrees). CAM_MOVE D : moves the camera by the distance D in its pointing direction POINT_OBJECT N : the camera points the 3D object number N | |
|
jicehel
Number of posts : 15 Registration date : 2013-03-12
| Subject: Re: Snapshot : PANORAMIC V 0.9.25i2 Tue Apr 30, 2013 12:23 pm | |
| English users, please show use you know writting some cool things. Your forum is too quiet, these new function are great. This is a little example from Jack to drive a red cube followed by the camera. This example are not using the new funtions and can be run from Panoramic version V 0.9.10 (june 2008) but it easy to test the new function with a few lines - Quote :
-
- Code:
-
' ======================================================= ' ' tutorial : drive a red cube followed by the camera ' ' ======================================================= ' ' scenario: ' 1 - a vehicule (red cube) is staying on a grid pattern (grownd) ' 2 - camera with set behind the vehicule ' 3 - the vehicule become drivable with the arrows keys and the ' camera follow the vehicule with some inertie ' ========================================================
' variables to draw the grid dim maxi,nb_case,taille_case,i
' variables to set vehicule and camera dim vehicx,vehicy,vehicz dim cam_posx,cam_posy,cam_posz dim posx_camera_cible,posy_camera_cible,posz_camera_cible dim deltax,deltay,deltaz,p
' variables to drive the vehicule and camera dim vitesse,direction,angle
' label for the game loop label loop
' max size of the grid maxi=800
' number of cases on X or Y nb_case=100
' size of a case taille_case=int(maxi/nb_case)
' univers 3D creation full_space 0:scene3D 1:full_space 1:color 1,0,0,0
' ======================================================== ' grid drawig on plan XZ for showing "ground" (horizontal plan) ' The plans XY et YZ are verticals plans ' ========================================================
' Drawing X axe prallel lines for i=0 to nb_case 3d_line i+3, 0, 0, i*taille_case 3d_line i+3, nb_case*taille_case, 0, i*taille_case 3d_line_width i+3,3 3d_color i+3,255,255,0 next i
' Drawing Z axe prallel lines for i=0 to nb_case 3d_line i+nb_case+4, i*taille_case, 0, 0 3d_line i+nb_case+4, i*taille_case, 0, nb_case*taille_case 3d_line_width i+nb_case+4,3 3d_color i+nb_case+4,255,255,0 next i
' creation of the vehicule 3d_cube 1,8:3d_color 1,255,0,0
' initial position of the vehicule vehicx=nb_case*taille_case/2 vehicy=4 vehicz=nb_case*taille_case/6 3d_x_position 1,vehicx 3d_y_position 1,vehicy 3d_z_position 1,vehicz
' creation of initial du starting count 3d_text 2,"9" 3d_y_rotate 2,180 3d_scale 2,4,4,4 3d_color 2,50,50,255
' initial position of the counting 3d_x_position 2,vehicx 3d_y_position 2,vehicy+5 3d_z_position 2,vehicz-5
' initial position of the camera cam_posx=vehicx cam_posy=500 cam_posz=vehicy cam_position cam_posx, cam_posy, cam_posz
' initial position of the light light_position vehicx, vehicy-20, vehicz-20
' =================================================== ' technique de lissage de mouvement: "camera follow" ' sur 80 trames, la caméra se positionne "doucement" ' derrière le véhicule (cube rouge) ' ===================================================
' la caméra va pointer en permanence sur le véhicule point_position vehicx, vehicy, vehicz
' point à atteindre par la caméra posx_camera_cible=vehicx posy_camera_cible=vehicy+5: ' 5 = un peu au dessus posz_camera_cible=vehicz-15: ' -15 = derrière
' vitesse de lissage p=0.08
for i=1 to 80 ' delta=cible-actuel deltax=posx_camera_cible-cam_posx deltay=posy_camera_cible-cam_posy deltaz=posz_camera_cible-cam_posz ' actuel=actuel+delta*p cam_posx=cam_posx+deltax*p cam_posy=cam_posy+deltay*p cam_posz=cam_posz+deltaz*p cam_position cam_posx, cam_posy, cam_posz 3d_text_change 2,str$(8-i/10) wait 50 next i
3d_text_change 2,"GO" caption 0,"*** Arrêt par la touche ESPACE ***" wait 500:3d_delete 2
' ======================================================================== ' pilotage en douceur du véhicule: ' la flèche du haut agit sur la vitesse et non sur la position. ' c'est la pédale d'accélérateur ' la flèche du bas est la pédale de frein ' ' il y a des frottements: si on lache l'accélérateur, le véhicule ralentit. ' ' la caméra suit le véhicule avec une inertie, comme si elle était attachée ' au véhicule par un élastique: c'est encore la technique "camera follow". ' ========================================================================
direction=0 vitesse=0
' vitesse de lissage p=0.1
loop: if scancode=38:' flèche haute vitesse=vitesse+.2 end_if
if scancode=40:' flèche basse vitesse=vitesse-.2 end_if
if scancode=39:' flèche droite direction=direction-2 3d_y_rotate 1,direction end_if
if scancode=37:' flèche gauche direction=direction+2 3d_y_rotate 1,direction end_if
if scancode=32 then terminate:' espace
' déplacement du véhicule 3d_move 1,vitesse ' ========================================== ' ici, il n'y a plus que 2 dimensions X et Z ' car on se déplace dans le plan XZ ' on ne calcule donc plus les positions sur Y ' ========================================== ' point à atteindre par la caméra angle=direction*.01745328 posx_camera_cible=o3d_x_position(1)-15*sin(angle) posz_camera_cible=o3d_z_position(1)-15*cos(angle) ' delta=cible-actuel deltax=posx_camera_cible-cam_posx deltaz=posz_camera_cible-cam_posz ' actuel=actuel+delta*p cam_posx=cam_posx+deltax*p cam_posz=cam_posz+deltaz*p cam_x_position cam_posx cam_z_position cam_posz point_x_position o3d_x_position(1) point_z_position o3d_z_position(1)
' simulation d'une friction: la vitesse diminue vitesse=vitesse-.08 if vitesse<0 then vitesse=0
wait 100 goto loop
| |
|