Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Lock object on...

Author
Message
Northern Lights
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Minnesota, USA
Posted: 21st Aug 2004 04:08 Edited at: 21st Aug 2004 06:39
Whenever I try to lock this ak47 to the screen, it flashes when I start up and then disappears. Can someone tell me why?


"Watson you idiot! Someone stole our tent!"
Bishop
22
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 21st Aug 2004 07:57
i believe (but dont quote me) than the object must be a significant distance from the camera in order for it to be locked on.....i dont know the exact distance, but i belive that it cannot be 0.....

anyway, i think thats the problem....
Bish

"But I, being poor, have only my dreams. I have spread my dreams under your feet. Tread softly because you tread on my dreams."
Balid
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location: MI, USA
Posted: 21st Aug 2004 08:37
superman,

The object can not be any closer then the close culling distance of the camera. I don't remember the default distance but try this (a line before or after 'lock object on')

position object 1,3,0,10

You may need to rotate your object to get it to point in the right direction but that should position so you can see it.

Northern Lights
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Minnesota, USA
Posted: 21st Aug 2004 11:55
Hmm...It still doesn't work. It doesn't have anything to do with the fact that I had to scale it up so much does it? I tried scaling it up 500 X 500 X 500 but the camera cuts of part of it.

"Watson you idiot! Someone stole our tent!"
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 21st Aug 2004 13:13
I noticed a few strange things with your code. First of all, your sync on commands should be at the top of your code before you do any drawing or anything. Next, turning off the autocam would be a good idea. Also, why does your object need to be scaled up so big? Just place it closer to the camera before you lock it on. Another thing I noticed was that you were placing your gun object at the lower right hand corner of the screen in the loop. If you do that, there's no need for the lock object command. Put the gun_placement(1) command before you lock your object.

Anyway, I went through your code and used a sphere instead of your object model. I also commented out the 3d sound parts so I could test it. Hopefully, with this you'll understand what's going on.



Oh, and your gun only flashes each time you shoot. I can show you how to make it look like a gun recoiling if you want, but I'm kinda out of time right now. Anyway, I hope my ramblings didn't discourage you too much. Good luck with DB

Lost in Thought
21
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Aug 2004 13:22 Edited at: 21st Aug 2004 13:26
[edit] This may not help at all stick to hyrichter's post mainly. I don't know how on this earth I ended up in the DBC forum. Guess I'm sleepier than I thought.

I don't have my DBP set up for .3ds so I converted a .3ds model to .dbo and that code

Works for me. At least the gun is locked to the screen and showing. The firing code doesn't work though because you are moving the gun back to fire and then returning it without a sync command between them so you never see the gun move. Also the mouselook code is a bit messed up here.
Here are some changes. They are not the best way to do things but I kept them close to the way you were doing them to help make it clearer what I was doing.

Hope this helps. To sleep now. Good luck.

BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 21st Aug 2004 16:00
Whoa..........500x500x500 is basically:

load object "ak47.3ds"
make object ak47.3ds 500 times as big as it was before
now try to lock it to the camera


Ya might not wanna scale so much, just a thought.

If your problem has already been fixed then ignore me, and you've just learned that scaling doesn't mess with culling (awesomeness).

Crazy Donut Productions, Current Project: Project Starbuks
Sony stole our name!
Northern Lights
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Minnesota, USA
Posted: 22nd Aug 2004 01:50 Edited at: 22nd Aug 2004 02:19
I had to scale it up so big because when its at a normal size and I put it so close to the camera, a lot of it gets cut off. set camera range doesn't work if the foreground value is less than 1 so I scaled the gun up to make it look closer. Is there another way to do it?

Edit:Yay! I got the gun to lock on, but when it locks on, it draws it oddly. Looks normal when locked off.

Lock on:


Lock off:


same code that hyrichter put only with gun and sounds.




Thanks for helping me so far everyone.




@hyrichter: How do you make the gun recoil?

"Watson you idiot! Someone stole our tent!"
Northern Lights
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Minnesota, USA
Posted: 22nd Aug 2004 10:22
HelloooOOOOo? Stupid thing still won't work after all my efforts...

"Watson you idiot! Someone stole our tent!"
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 23rd Aug 2004 07:11 Edited at: 23rd Aug 2004 07:17
Hey, hey, calm down now! I made an example of a gun recoiling and shooting a bullet. Since I don't have your gun model, I used a cylinder for the gun and a sphere for the bullet. Anyway, try this out. You may want to change some of the values to make the gun recoil faster or farther, but this gives you the genereal idea of a simple way to achieve this effect.



As for your gun showing up strangely, I really don't know what's causing that. I think I read somewhere tha the "lock object on" command can mess up the limbs of objects. If you can't get object locking to work properly, you're best bet would be to position the gun each loop. It wouldn't be too hard. If you want to email me the gun model, I'll try it out to see what's up with it. Cheers and good luck.

TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 25th Aug 2004 01:30
I have the same problem with my gun models.
'Lock Object On' seems to disable object zdepth at the same time and you can't enable it again.

Current Projects: Dark_Worlds_Map_Editor version0.1 [email protected]
[img]http://www.uploadimages.net/images/331935avatar2.JPG[img]
Northern Lights
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Minnesota, USA
Posted: 29th Aug 2004 02:34 Edited at: 29th Aug 2004 02:37
@hyrichter:please note that the hello wasn't directed at you, simply at my efforts to make it work. Thanks for the code .
How would you position the gun on the screen? I tried rotating it with the camera and positioning it under the camera but it rotates oddly. I used the same rotation method as for the camera except I rotated the gun...

"Watson you idiot! Someone stole our tent!"

Login to post a reply

Server time is: 2025-05-25 02:08:08
Your offset time is: 2025-05-25 02:08:08