Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AbrahamR), 717 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Position auf Kugel #348031
11/22/10 00:21
11/22/10 00:21
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline OP
Expert
Tempelbauer  Offline OP
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
hi

ich hab grad ne denkblockade...
ich will eine entity auf einer kugel positionieren, abhängig von der maus. wenn ich maus auf der x achse bewege, soll die entity auf einem breitengrad begewegen und wenn die maus auf der y achse bewegt wird auf einem längengrad.

würde dann ja gehen mit:
x = r * sin(br) * cos(lg)
y = r * sin(br) * sin(lg)
z = r * cos(br)

aber ich komm einfach nicht auf die berechnung von br und lg. muss ja irgendwie mouse_force mitunterbringen...

Re: Position auf Kugel [Re: Tempelbauer] #348066
11/22/10 13:01
11/22/10 13:01

M
mercuryus
Unregistered
mercuryus
Unregistered
M



Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

var r= 36;
var x, y, z;
var br, lg;

PANEL* pan_coord = {
	digits = 10, 10, "br: %3.0f", *, 1, br;
	digits = 10, 30, "lg: %3.0f", *, 1, lg;
	flags=VISIBLE;
}	


action act_kugel(){

	br=0; lg=0;

	while(1){
		x = r * sin(br) * cos(lg);
		y = r * sin(br) * sin(lg);
		z = r * cos(br);
		
		br=(br+key_force.y*time_step*50)%360;	// oder mouse_force.
		lg=(lg+key_force.x*time_step*50)%360;
		
		vec_set(my.x, vector(x, y, z));
		
		wait(1);
	}	
		
}





void main(){
	
	level_load(NULL);
	ent_create("kugel.mdl", nullvector, NULL);
	ent_create("rkugel.mdl", nullvector, act_kugel); // entity
	
	vec_set(camera.x, vector(-200, 0, 0));
	
}




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1