Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Rotate Camera/View Around Object? #367711
04/17/11 03:46
04/17/11 03:46
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
I am learning some Lite-C programming and have been able to get a PC to move, jump, etc, to include external Lite-C files, etc. Now I have a task and am a bit lost and hoping someone here can point me in the right direction.

I want to load a single MDL file and then, via clicking the LMB and dragging, move the view around the model. This way the end-user could rotate and view the model from any angle. The model, of course, would stay centered in the view.

Is there a tutorial for this or an example file that I can use to learn from?

Any help would be appreciated.

Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367712
04/17/11 03:57
04/17/11 03:57
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
look down 4 posts to "force an object to be in front of the player"

Then look up mouse_force in the manual.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: Rotate Camera/View Around Object? [Re: FoxHound] #367714
04/17/11 04:08
04/17/11 04:08
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
Thanks for the pointers. I'll take a look! laugh

Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367715
04/17/11 04:15
04/17/11 04:15
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
I'm having trouble getting the script to work. I must be doing something really bone headed.

In any case, what I really want is for the model to be the "player" and the mouse to move the camera/view around the player. So, essentially, there would be no "player", but a model in the center of the view that the camera/view would rotate around.

Sorry for me being so dense with this. It's a new world for me. laugh

Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367716
04/17/11 04:18
04/17/11 04:18
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
As an alternative, I could get away with rotating the actual object/model instead of rotating the view. It doesn't matter to me. I just need to present a single model that the end-user can look at from any angle via click-dragging in the view with the LMB depressed. laugh

Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367717
04/17/11 04:20
04/17/11 04:20
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
Oooh! mouse_force does what I want! Now I just need to lock the player in place or set the view first!

Thanks for the pointer!

Now I just need to get the basic mouse_force to function ONLY when the LMB is depressed and not have it on at all times.

Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367718
04/17/11 04:29
04/17/11 04:29
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
if(mouse_left){
really cool code to move the camera around the model goes here

}

"player" is just a pointer and can be given to any entity. Even an NPC. Now that would be funny.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: Rotate Camera/View Around Object? [Re: FoxHound] #367721
04/17/11 04:52
04/17/11 04:52
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
Thanks again for your help. However, I am not getting this to work. The object rotates by just moving the mouse, even if no mouse button is pressed. Here is my code:

Code:
if (mouse_left){
action rotate()
{
  while(1)
 	{
 	  my.pan += mouse_force.x;	// mouse movement changes PAN 
 	  my.tilt += mouse_force.y;	// mouse movement changes TILT
 	  wait(1);
 	}
}
}



Re: Rotate Camera/View Around Object? [Re: RealSerious3D] #367722
04/17/11 04:54
04/17/11 04:54
Joined: Jan 2010
Posts: 145
Doc_Savage Offline
Member
Doc_Savage  Offline
Member

Joined: Jan 2010
Posts: 145
noobish question here, but why is that an action? and should it be action_rotate? you forgot the _ tongue


Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: Rotate Camera/View Around Object? [Re: Doc_Savage] #367723
04/17/11 04:59
04/17/11 04:59
Joined: Oct 2010
Posts: 346
USA
RealSerious3D Offline OP
Senior Member
RealSerious3D  Offline OP
Senior Member

Joined: Oct 2010
Posts: 346
USA
Quote:
you forgot the _


Where?

The code "works" in that the object rotates as I move the mouse. I just can't figure out how to attach it to the left mouse button. tongue

Hey! I'm an artist. All this programming is completely new to me. grin

Page 1 of 2 1 2

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