Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 3d_chain and 3d_chain_break problems

View previous topic View next topic Go down 
AuthorMessage
treehouse

avatar

Number of posts : 10
Age : 56
Localisation : Yorkshire, UK
Registration date : 2013-10-16

PostSubject: 3d_chain and 3d_chain_break problems   Fri Oct 18, 2013 2:31 am

Hello again,

I'm having problems getting the chain commands working for 3d objects. The following code might demonstrate them. I have elaborated on an example.

I think I had to change the order of 3d_chain N, P parameters from the example, but I seem to have lost the original. I believe N becomes the parent and its transformations affect P. I'm not sure if this is my error (and "P" suggests "Parent"), but I can't get it to work that way, and clearly chaining them the other way does cause P to take translations given to N (the blue cube drags the pink one with it).

1. Sometimes I found that on chaining, P disappears from view. The ball does this for me in the code below if it is created and not positioned off the origin. Then (positioned) it remains on screen, but when chained it immediately changes position!

2. I have tried chaining the ball (3) to the first cube (1) with
3d_chain 1,3 as the docs say many can be chained to a single object (again, assuming N is the parent), but this gives the error "3D object is already chained". Various other combinations actually throw up exception errors. For instance,
3d_chain 3,1 gives "Access violation at address 00403E12 in module 'PANORAMIC.exe'. Read of address 00000000."

3. Breaking the chain doesn't seem to have any effect. scratch 

One thing this does seem to demonstrate is that I have chained these objects 1-2-3. The last movements address just 1, but 2 and 3 follow, and apparently 3 is only chained to 1 via 2.

If anyone can shed light on this, I'd be very grateful. I basically just want to create a scene and then make it look like the observer is rotating, which means rotating all objects together.

Super program, thanks.bounce 

Code:
height 0, 300
width 0, 700
rem create a 3D world
scene3d 1
rem give it all the available space
full_space 1
' "create a cube (3D object number 1)"
3d_cube 1,1
' "create another cube (3D object number 2)"
3d_cube 2,1
' "move this cube"
3d_x_position 2,3
' "color it"
3d_color 2,200,0,0
' "color the first box"
3d_color 1,0,0,20:wait 1000
message "chain the second cube to the first (1,2)"
3d_chain 1,2
message "move the SECOND cube ONLY"
3d_x_position 2,2.6:wait 1000
message "move the TWO cubes"
3d_x_position 1,-1:wait 1000
message "rotate the TWO cubes"
3d_z_rotate 1,10:wait 1000
message "create a ball"
3d_sphere 3,0.4
3d_y_position 3,-1:wait 1000
message "chain 2,3 ? Ball to pink cube"
3d_chain 2,3:wait 1000
message "rotate red"
3d_z_rotate 2,-5
message "break the chain 1-2"
3d_chain_break 1,2
wait 1000
message "rotate the first cube: 2 should be unchanged"
3d_z_rotate 1,0:wait 1000
message "move the first cube in Y dimension"
3d_y_position 1,1
end
If someone has the original version to post, it might solve some of these issues, but I couldn't get it to work.
Back to top Go down
View user profile
bignono

avatar

Number of posts : 11
Age : 60
Localisation : Champigny-sur-Marne, 94500, France
Registration date : 2013-03-12

PostSubject: Re: 3d_chain and 3d_chain_break problems   Fri Oct 18, 2013 10:36 am

Hello, Smile 
Excuse bad English, but I use an on-line translator!
I think of seizing that you have difficulty with the instruction 3d_chain. Indeed, this one is difficult of employment(use). Myself had of enormous difficulties including how she(it) works, even even now. I use him(it) especially with "mesh".
Because you seem to be interested in the 3D, on this forum you will find some programs using the 3D that I realized:
- The tower of Hanoï: http://panoramic.top-forum.net/t107-the-tower-of-hanoi
- How to move in a scene in 3D: http://panoramic.top-forum.net/t109-how-to-move-in-a-scene-in-3d
- To build cities in 3D: http://panoramic.top-forum.net/t116-to-build-cities-in-3d
Now, to go farther, you can go(surrender) on my Web dav where there is quantity of programs in free access in the "3D" file(case), numerous programs of unfinished tries(essays), on the 3D, and in the file(case) "Jeux", there are 3 programs using the 3D with sometimes the instruction 3D_CHAIN:
- biduminus.zip
- buggy.zip
- fort_labyrinth.zip

my Web dav :
Identifier: panoramic@bignono
Password:  panoramic123

good luck Wink Wink Wink 
Back to top Go down
View user profile
treehouse

avatar

Number of posts : 10
Age : 56
Localisation : Yorkshire, UK
Registration date : 2013-10-16

PostSubject: Re: 3d_chain and 3d_chain_break problems   Sat Oct 19, 2013 12:19 pm

(Posted in wrong thread earlier)

Merci. Vous êtes très gentil. J'ai commencé à étudier votre code.

Une suggestion. Après les touches enfoncées pendant un certain temps, le mouvement devient continu. Si vous changez key_down_code à key_up_code dans toutes les lignes de t2:, ce n'est pas le cas. Je pense que c'est plus correct. Les actions encore combinent.

Voulez-vous s'il vous plaît ré-écrire mon code afin que 3d_chain et 3d_chain_break sont corrects?

J'espère que Google Translate fait un bon travail. Il est probablement mieux que je pouvais faire seul.

In English:
Thanks. You are very kind. I have started to study your code.

One suggestion. After holding down the keys for some time, motion becomes continuous. If you change key_down_code to key_up_code in all the lines of t2:, this does not happen. I think that is more correct. The actions still combine.

Would you please re-write my code so that 3d_chain and 3d_chain_break are correct?

I hope Google translate did a good job. It is probably better than I could do alone.


Best wishes
John
Back to top Go down
View user profile
bignono

avatar

Number of posts : 11
Age : 60
Localisation : Champigny-sur-Marne, 94500, France
Registration date : 2013-03-12

PostSubject: Re: 3d_chain and 3d_chain_break problems   Sat Oct 19, 2013 1:06 pm

Hello, Smile 
Very difficult to understand(include) how work 3d_chain!
Your a little modified example:
Code:
height 0, 400:width 0, 700
scene3d 1:full_space 1

3d_cube 1,1:3d_color 1,0,0,200
3d_cube 2,1:3d_color 2,200,0,0:3d_x_position 2,3

3d_chain 1,2

message "move the SECOND cube ONLY"
 3d_x_position 2,2.6:wait 1000
message "move the TWO cubes"
3d_x_position 1,-1:wait 1000
message "rotate the TWO cubes"
3d_z_rotate 1,10:wait 1000

message "create a cone"
3d_cone 3,1,1.1:3d_y_position 3,-1:wait 1000
message "chain 2,3: cone to pink cube"
3d_chain 2,3:wait 1000
' here the cone take position of pink cube because he is chained to the pink cube
message "rotate pink cube"
3d_z_rotate 2,-5:wait 1000
' here only cube and cone rotate
message "rotate all objects"
3d_z_rotate 1,30:wait 1000
' here all objects are commanded by cube number one
message "break the chain 2-3"
3d_chain_break 2,3:wait 1000
' message "break the chain 1-2"
' 3d_chain_break 1,2:wait 1000
message "rotate the first cube"
3d_z_rotate 1,0:wait 1000
message "move the first cube in Y dimension"
3d_y_position 1,1:wait 1000
3d_chain_break 1,2
end
Another way of using 3d_chain, but there, it needs that objects is all of the same type(chap):
Code:
height 0, 400:width 0, 700
scene3d 1:full_space 1

3d_cube 1,1:3d_color 1,0,0,200:' blue
3d_cube 2,1:3d_color 2,200,0,0:3d_x_position 2,3:' red
wait 1000
message "chain 2 to 1"
3d_chain 2,1:wait 1000
' here the first cube take same position of 2nd

message "if move the SECOND cube ONLY, the first cube move with second"
 3d_x_position 2,2.6:wait 1000
message "if move the first cube ONLY the first cube move"
 3d_x_position 1,-2.6:wait 1000
message "now, if move the SECOND cube two cubes move"
3d_y_position 2,1:wait 1000

message "create a cube number 3" :' black
3d_cube 3,1:3d_y_position 3,-1:wait 1000
message "chain 3 to 2"
3d_chain 3,2:wait 1000
message "chain  break 3 to 2"
3d_chain_break 3,2:wait 1000
message "chain 3 to 1"
3d_chain 3,1:wait 1000
message "chain  break 3 to 1"
3d_chain_break 3,1:wait 1000
message "move the first cube":' blue
3d_x_position 1,-1:wait 1000
message "move the second cube" :' red
3d_y_position 2,2:wait 1000
message "move the cube number 3 => all cubes move" :' black
3d_y_position 3,0.5:wait 1000
message "logic of 3d_chain is difficult to understand"
end
Excuse bad English.
Wink Wink Wink
Back to top Go down
View user profile
bignono

avatar

Number of posts : 11
Age : 60
Localisation : Champigny-sur-Marne, 94500, France
Registration date : 2013-03-12

PostSubject: Re: 3d_chain and 3d_chain_break problems   Sat Oct 19, 2013 1:07 pm

Now, on my Web dav, download " treehouse.zip ". There are 2 programs. Install(settle) everything in the file(case) of your choice, and in 2 programs, adapt "rep$"
others programs in  the file(case) "jeux" in 3d!
http://www.mydrive.ch/
identifier: panoramic@bignono
password: panoramic123
I hope to have helped you.
Back to top Go down
View user profile
treehouse

avatar

Number of posts : 10
Age : 56
Localisation : Yorkshire, UK
Registration date : 2013-10-16

PostSubject: Re: 3d_chain and 3d_chain_break problems   Mon Oct 21, 2013 1:28 am

I'll post in English this time. You have helped me to make some progress, bignono, but I need to understand more of the background information about 3d_chain, mesh, 3ds files and so on. You may not be able to help further with the language issue, but if you can, don't hesitate - I just don't want to take up too much of your time over this. Thanks again.

To be honest, after a lot of experimenting, I am beginning to lose patience. It would be easier to calculate the movements of individual objects in a viewport and move them in a loop!

I do not know why chaining objects works for .3ds files, but not for created objects in the code. I have replaced your loaded .3ds objects with created cubes in cub3.bas (I know that they will all be aligned), and when I turn the last (as usual), one or more of them does not turn. I can't imagine that I have to create objects and then save them to 3ds files and re-load them as "mesh" objects in order to chain them. The help docs only mention mesh as a preliminary to using file objects. Surely 3d_chain should work the same on all 3d objects?

Other experiments convince me that either there is a bug in the interpreter regarding 3d_chain and 3d_chain_break, or my understanding is way off.

Why do objects move when merely "un-chained" (broken)? There doesn't seem to be any logic to where they move to, either. (See code below)

Why does breaking the 2-3 chain cause 1-2 to be broken instead of 2-3?

Should o3d_x_position(n) etc., return 0's for a child object when newly chained to a parent not at the origin? I.e., does the child object take on the current position of its parent as a new origin? (It seems so from my program, below, but it seems weird.)

And may God help the translator bots! affraid

Code:
height 0, 300
width 0, 700
rem create a 3D world
scene3d 1
rem give it all the available space
full_space 1
rem mark origin
3d_cone 99,0.1,0.1
3d_cube 1,1
3d_color 1,0,0,20
3d_cube 2,1
3d_chain 1,2
3d_x_position 2,3
3d_color 2,200,0,0
message "Made 2 cubes, red chained to blue. Move the red cube...":wait 500
3d_x_position 2,2.6:wait 500
message "Move the blue cube (parent of red) left...":wait 500
3d_x_position 1,-1:wait 500
message "We can see origin cone. Move blue away...":wait 500
3d_z_position 1,-1:wait 500
message "Rotate it...":wait 500
3d_z_rotate 1,20:wait 500
message "OK so far. Red goes with blue. Create a ball..."
3d_sphere 3,0.6:wait 500
message "...at the origin, as usual. Now chain it to red, (make red its parent)..."
3d_chain 2,3
message "Moves to red! OK. Where is it?...x,y,z..."
message o3d_x_position(3)
message o3d_y_position(3)
message o3d_z_position(3)
message "Is something wrong with O3D_._position? Let's try red...x,y.z..."
message o3d_x_position(2)
message o3d_y_position(2)
message o3d_z_position(2)
message "Wrong. Red isn't at y=0 or z=0."
message "Ball can be placed independently...":wait 500
3d_y_position 3,-1:wait 500
message "Rotate red (parent of ball)...":wait 500
3d_z_rotate 2,-50:wait 500
message "OK. Is blue still parent of red + ball? Move it left...":wait 500
3d_x_position 1,-2:wait 500
message "Yes. Now, let's break the chain 2-3 (red-ball)":wait 500
3d_chain_break 2,3
message "Why does just breaking the chain move them?"
message "Now rotate the red cube: ball should not move":wait 500
3d_z_rotate 2,-20
message "Error: 3d_chain_break 2,3 did not break chain. And..."
message "Move blue cube in Y dimension (should still be parent of red cube)":wait 500
3d_y_position 1,1:wait 500
message "Error: the wrong chain (1-2) has been broken?"
end
Back to top Go down
View user profile
bignono

avatar

Number of posts : 11
Age : 60
Localisation : Champigny-sur-Marne, 94500, France
Registration date : 2013-03-12

PostSubject: Re: 3d_chain and 3d_chain_break problems   Mon Oct 21, 2013 10:08 am

Hello, Smile 
I understand your problem. Effectively, your program demonstrates well that there is a "bug" with 3d_chain and 3d_chain_break. I think that it would be necessary to make raise the information to Jack, the designer of Panoramic. The 3D library(bookcase) used by Panoramic has to have certainly still bugs.
I thus advise(recommend) you to post your program and your question in the column(section) " Help? " As well as in the French forum in the column(section): "Un bug dans PANORAMIC?" To inform Jack.
Cordially
Wink Wink Wink
Back to top Go down
View user profile
treehouse

avatar

Number of posts : 10
Age : 56
Localisation : Yorkshire, UK
Registration date : 2013-10-16

PostSubject: Re: 3d_chain and 3d_chain_break problems   Mon Oct 21, 2013 12:42 pm

Thanks, it is good to have your opinion. I will join the French forum and post it there. Hopefully, my French will improve as well as my Panoramic.
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: 3d_chain and 3d_chain_break problems   

Back to top Go down
 
3d_chain and 3d_chain_break problems
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Selenium installation problems
» New here--Kidney problems after taking Relpax?
» problems with voluntary work need advice about what to say
» people comparing their problems to yours
» Testosterone and neurological problems

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Help?-
Jump to: