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 Professional Discussion / Following another object's scaling

Author
Message
DB_Newbie
16
Years of Service
User Offline
Joined: 4th Aug 2009
Location:
Posted: 9th Apr 2010 06:13 Edited at: 9th Apr 2010 06:19
Hi all,

I'm trying to make a ball roll along the ground and when I jump, it compresses first before actually jumping. So in other words, before it jumps, I scale its height (Y axis) by half and when it is in the air, I restore its height.

I also want my ball to roll while moving left and right. However, this effects my scaling since the scale is in relations to the ball's local Y axis and since it rolls, the Y axis changes.

Here is my code thus far:



In the jump code, you can see the compression via the object scaling. In the movement code, you can see variable "roll" that controls the ball rolling (which is refreshed in the DO LOOP).

So how do I keep the ball rolling, but be able to compress it always on its Y axis. I COULD reset the rotation of the ball before compressing, but I want to texture the ball so that it looks like a basketball, or a beachball and resetting the ball's rotation will be noticeable.

EDIT: Changed the code to my latest. Sorry about that.
NightX
17
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 9th Apr 2010 10:07
just a suggestion, possible dont use the ball as the collision object, but a tiny hidden box as the collision object, and then you move the tiny box around, and place the ball at the tiny box's position.

DB_Newbie
16
Years of Service
User Offline
Joined: 4th Aug 2009
Location:
Posted: 9th Apr 2010 12:06
Well that actually solves a bug in the code. Thanks =D

But how do I solve my problem?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Apr 2010 12:48
You could use scroll object texture to make it look like the ball is rotating instead of actually rotating it.

TheComet

DB_Newbie
16
Years of Service
User Offline
Joined: 4th Aug 2009
Location:
Posted: 9th Apr 2010 13:14
SCROLL OBJECT TEXTURE?

So that will "rotate" the texture? I never used that function before. Can you give me an example code?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Apr 2010 13:32
It's an excellent suggestion.

Try this:

DB_Newbie
16
Years of Service
User Offline
Joined: 4th Aug 2009
Location:
Posted: 9th Apr 2010 15:00
Cool! Thanks.

I'll try implementing that code when I go back to school (for some reason DBPro doesn't work properly on my computer >_>

I'll post up the results next week ^^

Thanks again

Login to post a reply

Server time is: 2026-07-26 15:31:38
Your offset time is: 2026-07-26 15:31:38