Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, EternallyCurious, Petra, 1 invisible), 764 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
rotating many objects #243975
01/02/09 00:07
01/02/09 00:07
Joined: Oct 2008
Posts: 24
Germany
H
Hazardos Offline OP
Newbie
Hazardos  Offline OP
Newbie
H

Joined: Oct 2008
Posts: 24
Germany
Good morning everyone,

I've got a problem which won't let me go to sleep!

I create many Cubes and each has got 12 Edges, so I create 12 Edges for every Cube! The Cube has got three skills: rotating, scaling, moving. If a Cube changes its form the edges have to change its form, too. Therefore I've simply written an action which moves, scales and rotates each Edge of a cube.

The Problem: By increasing the number of Cubes (with 12 edges each) the game crashes. Why does this happen?

Thanks for ur help!

Code:
action Edge()
{
	var rot[3]; 
			//the relative vector pointing from the
			// middle of the non-rotated Cube to the Edge

			//First, the edge searches for its cube
			//skill53 = number of the Cube
			//skill54 = number of the edge (1..12)
			//or zero for the Cube
	
	you = ent_next(NULL);
	while (!((you.skill53==my.skill53)&&(you.skill54==0)))
		you = ent_next(you);
	

			//Each frame the Edge calculates its position, rotation and scaling.

	while(1)
	{
		switch (my.skill54)
		{
			case 1:
				{
					rot[0] = 0;
					rot[1] = -you.scale_y/2;
					rot[2] = you.scale_z/2;	
					my.scale_x = you.scale_x + 5;
					my.scale_y = 5;
					my.scale_z = 5;
				}

			[...]

			case 12:
				{
					rot[0] = you.scale_x/2;
					rot[1] = you.scale_y/2;
					rot[2] = 0;
					my.scale_x = 5;
					my.scale_y = 5;
					my.scale_z = you.scale_z-5;
				}
		}
		
		vec_rotate (rot,vector(you.pan, you.tilt, you.roll));
		
		my.x = you.x;
		vec_add(my.x, rot);
		my.roll = you.roll;
		my.tilt = you.tilt;
		my.pan = you.pan;
		wait (1);	
	}			
}


Good night!

Re: rotating many objects [Re: Hazardos] #243976
01/02/09 00:09
01/02/09 00:09
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
check if(you!=null)

any error messages?


3333333333
Re: rotating many objects [Re: Quad] #243979
01/02/09 00:19
01/02/09 00:19
Joined: Oct 2008
Posts: 24
Germany
H
Hazardos Offline OP
Newbie
Hazardos  Offline OP
Newbie
H

Joined: Oct 2008
Posts: 24
Germany
no, definetely not!
I have to add, that i have written an own function to rotate the edges. But this costs too much performance. perhaps the function of acknex is faster than mine.

[EDIT]
No, it is not!
I just build as much cubes as i could build with the acknex-rotate-function and compared the framerate with the framerate by using my function. The result: mine is faster.

Nevertheless I want to know, where the problem is.

I'd just begun using Gamestudio. Sometimes the manual hides important informations (or it is written somewhere where a newbie would not search for).

Last edited by Hazardos; 01/02/09 00:29.

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