회원 로그인
|
Expression - rand
객체.attribute = rand(limit, limit);
//예제1) //pCube1가 translate X의 1~50 사이로 렌덤하게 한 프레임씩 이동하게 된다. pCube1.translateX = rand(1, 50); //예제2) //pCube1가 translate X의 -50~50 사이로 렌덤하게 한 프레임씩 이동하게 된다. pCube1.translateX = rand(-50, 50);rotate와 scale, visibility도 가능하다.
* visibility는 on (1) / off (0) 이므로
pCube1.visibility = rand(0, 1);이렇게 해주면 된다.
활용 예제)
컨트롤 아이콘을 달아 expression을 제어하도록 해보자.
![exp_rand0102.jpg](http://dvframes.com/rb/files/attach/images/481/350/001/afcd234337dea8e7100b7939ec7e1685.jpg)
conIcon이라는 이름으로 curve를 만들어 conIcon이라고 attribute를 추가한 후 pCube1에 expression을 적용한다. curve인 conIcon의 on_off가 0이면 rand 명령을 중단하고, 1이면 expression이 작동된다.
if (conIcon.on_off == 1) { pCube1.translateX = rand(-1, -50)+rand(1,50); pCube1.translateY = rand(-1, -50)+rand(1,50); pCube1.translateZ = rand(-1, -50)+rand(1,50); pCube1.scaleX = rand(-1, -50)+rand(1,50); pCube1.visibility = rand(0, 1); } else {}
- exp_rand.mb (55.1KB) (0)
![](/rb/modules/bbs/theme/_pc/list01/image/ico_comment.gif)
466개(1/24페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
![]() |
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 48304 | 2020.04.06 17:22 |
![]() |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 68446 | 2014.01.08 17:59 |
464 |
[Dev] Autodesk Maya Devkit 다운로드
![]() |
푸딩뱃살 | 787 | 2023.01.28 14:28 |
463 | [Base] (해결 중) modules 환경설정 중 | 푸딩뱃살 | 705 | 2022.11.09 11:47 |
462 | [Script] pymel 딕셔너리형 사용 시 KeyError | 푸딩뱃살 | 975 | 2022.11.07 12:08 |
461 | [오류] Building Numpy for Maya Python 2.7.x | 푸딩뱃살 | 654 | 2022.10.23 14:38 |
460 |
[Base] 뷰포트에서 조절자가 안 보일때
![]() |
푸딩뱃살 | 862 | 2022.10.13 15:47 |
459 | [Rigging] mirror joints 사용 시 유의 사항 | 푸딩뱃살 | 863 | 2022.10.04 10:46 |
458 |
[Script] 2022에서 enum34 모듈 설치 금지
![]() |
푸딩뱃살 | 641 | 2022.08.17 18:08 |
457 | [Script] pymel 예제 | 푸딩뱃살 | 657 | 2022.07.05 19:20 |
456 | [Script] 인코드 / 디코드 - 2.7 한글 사용 | 푸딩뱃살 | 951 | 2022.03.08 17:52 |
455 |
[Dev] ui 없이 mayapy로 자동화
![]() |
푸딩뱃살 | 755 | 2022.02.17 13:56 |
454 | [Dev] mayapy로 ui파일 py로 | 푸딩뱃살 | 559 | 2022.02.15 18:20 |
453 | [오류] Error : MayaBonusTools | 푸딩뱃살 | 988 | 2022.01.21 17:52 |
452 | [오류] Error: ModuleNotFoundError | 푸딩뱃살 | 826 | 2022.01.21 16:24 |
451 |
[Dev] mayapy
![]() |
푸딩뱃살 | 711 | 2022.01.19 20:08 |
450 |
[Base] function selCom at 0x7f29c5c04aa0
![]() |
푸딩뱃살 | 670 | 2022.01.19 17:24 |
449 |
[Base] wireframe on shaded 단축키 만들기
![]() |
푸딩뱃살 | 973 | 2022.01.04 10:55 |
448 | [오류] OpenCL Error | 푸딩뱃살 | 551 | 2021.12.28 01:40 |
447 |
[Script] Easily Translate MEL Commands to Python
![]() |
푸딩뱃살 | 918 | 2021.12.02 11:22 |
446 |
[Base] output window 띄우지 않기
![]() |
푸딩뱃살 | 890 | 2021.11.24 21:44 |
445 | [Rigging] shapeEditorManager 삭제 안됨 | 푸딩뱃살 | 960 | 2021.11.12 23:30 |