Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (3run, Grant, 1 invisible), 3,863 guests, and 14 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rotate entity as mouse move #182818
02/09/08 03:55
02/09/08 03:55
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Hi,
I take cylinder as entity and want to rotate as mouse move.
I have use mickey.But it rotate in every direction.That is
it also going back.
It should be rotate just x and y of the screen in every view.
How can i do this ?
Please help

Re: Rotate entity as mouse move [Re: harry3174] #182819
02/09/08 23:26
02/09/08 23:26
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
You need to use mouse_force.x/y for this:

Code:

void grabRotate()
{
if(event_type== EVENT_CLICK)
{
while(mouse_left== 1)
{
my->pan+= (mouse_force.x * 10) * time_step;
my->tilt-= (mouse_force.y * 10) * time_step;
wait(1);
}
}
}

void event_handle()
{
my->emask|= ENABLE_CLICK;
my->event= grabRotate;
}

...

ent_create("[i]filename here[/i]",[i]vector pos[/i],event_handle);



That's a basic "rotate entity with mouse" code.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Rotate entity as mouse move [Re: MrCode] #182820
02/12/08 12:51
02/12/08 12:51
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Thanks for your reply.
Here is my code:
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
ENTITY* cy1;

function grab_Rotate()
{
if(event_type == EVENT_CLICK)
{
while(mouse_left== 1)
{
my.pan+= (mouse_force.x * 10) * time_step;
my.tilt-= (mouse_force.y * 10) * time_step;
wait(1);
}
}
}
action event_handle()
{
my.emask |= ENABLE_CLICK;
my.event = grab_Rotate;
}

function main()
{

level_load("creat.wmb"); // load the level
wait (2); // wait until the level is loaded
ent_create ("cy1.mdl", vector(0, 0, 0), NULL); // create the cylinder
}
Its give me error in if(event_type == EVENT_CLICK) and my.emask |= ENABLE_CLICK;
I cant understand why?
Please help


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

Gamestudio download | 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