Im assuming you're fairly new to DBP judging fro what you're trying to accomplish here, so Ill go about this using an extremely basic method.
First off, lets think of wat you're trying to accomplish. You want the paddle to move left when the left movement button is pressed (lets say the left arrow key for now), and right when the right key is pressed (right arrow key). Also, you need the object to stay in a circular pattern, in other words moving around a pivot point while maintaining the same distance from the object at all times.
There are a few ways of accomplishing this, 4 main ones basically;
- Use a mathematical formula to calculate the object's new X,Y and Z position (fairly hard)
- Use a limb to determine the positioning of the paddles, and then instead of moving the paddles you rotate the limb (not too hard, but not needed for something like this)
- Position the object at the pivot point, rotate it, and then move it backwards to the radius of the circle (getting easier)
- Just use the object rotation/side movement commands to move the object. (we'll use this one)
So, first off these are the commands we're going to be looking into for this;
POINT OBJECT, MOVE OBJECT RIGHT, MOVE OBJECT LEFT
First off, lets setup the basic program layout;
`Paddle Movement Demo
`Apply main settings
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
`Create a paddle object
MAKE OBJECT BOX 1,30,5,10
POSITION OBJECT 1,0,0,-100
`Position/Point the camera
POSITION CAMERA 0,200,-300
POINT CAMERA 0,0,0
`Start the main loop
DO
`Refresh the screen and end the loop
SYNC
LOOP
Hopefully you understand what thats doing so far. Run it and youll basically just see a box.
Now lets add some basic left and right movement to the box, add this code inside the main loop:
`Movement Controls
IF LEFTKEY()=1 THEN MOVE OBJECT LEFT 1,.5
IF RIGHTKEY()=1 THEN MOVE OBJECT RIGHT 1,.5
Running that you'l now have the ability to move the paddle left and right.
Now we'll add in the rotation. The POINT OBJECT command will point an object to a 3D coordinate. So, we'll use the POINT OBJECT command to make sure object 1 (our paddle) is always pointing towards 0,0,0 (the center). Add this code after the movement code;
`Point the object to 0,0,0
POINT OBJECT 1,0,0,0
Now run the code and youll see that you can move left and right, while the paddle folows a circular path.
Summing up the end code will be;
`Paddle Movement Demo
`Apply main settings
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
`Create a paddle object
MAKE OBJECT BOX 1,30,5,10
POSITION OBJECT 1,0,0,-100
`Position/Point the camera
POSITION CAMERA 0,200,-300
POINT CAMERA 0,0,0
`Start the main loop
DO
`Movement Controls
IF LEFTKEY()=1 THEN MOVE OBJECT LEFT 1,.5
IF RIGHTKEY()=1 THEN MOVE OBJECT RIGHT 1,.5
`Point the object to 0,0,0
POINT OBJECT 1,0,0,0
`Refresh the screen and end the loop
SYNC
LOOP
Hope this sheds some light on things,
- RUC'
Oh, and welcome to the forums